actionscript-3

Import classes from external SWF

I have a bunch of classes in an SWF file. I'd like to use them in my Flash project. How do I import them? External SWF package com.external { public class Class1 {} } In my project I want to write import com.external.*; var myclass:Class1 = new Class1(); ...

Minimize number of imports in AS3

Just wondering, is it possible to limit number of 'imports' in AS3 code by defining them in parent class or in any other way? Thanks in advance ...

Good logging framework for ActionScript 3 projects

Good day! I'd like to found some logging framework for AS3. For now I use trace() and debug version of Flash Player, but I'm looking something that can be enabled without having debug version installed? Thanks in advance! ...

AS3 Using a variable with Transform

I have a text field and a background and want to apply color using myColorPicker. Either the text field or background can be selected using radioGroup1. When either radio button is selected the trace statement traces the variable obj2Clr exactly. However when I use that variable with Transform, I can't apply color. If I hard co...

Where is the "proper" place to initialize class variables in AS3

Is it "better" to initialize AS3 class variables in the class constructor? Or can I just initialize them to their default value when I declare them at the top of my class? I ask because when there's a lot of class variables, it appears inefficient to declare them in one place and then initialize them in another when I could easily do b...

Why put import statements in package?

In AS3, why do we put our import statements in the package statement, and not inside the Class declaration? This is a typical (but rather pointless) AS3 class: package my.foo.package { import flash.display.MovieClip; import flash.events.Event; import flash.events.TimerEvent; import flash.utils.Timer; public class F...

How to do Flex date deduction and addition

Hi guys, In flex, I am trying to do date deduction and addition, but couldn't find a way to do it. e.g.: public var dateNow:Date=new Date(); How can I get the Date 3 months earlier than dateNow? Thanks!!! ...

How do nested tags work in E4X?

Suppose I have the following XML: var foo:XML = <root><a>this is a <b>special</b> case</a></root> Is there any way to detect the position of <b> relative to the contents of <a> without a custom subparser? ...

Incorrect syntax highlighting Vim (Actionscript 3)

The braces shown below after ...ret):String are incorrectly being highlighted as red I'm using the following syntax definition file for actionscript: http://www.vim.org/scripts/script.php?script_id=1061 2 Questions: Does anyone happen to know off-hand what causes this weird matching? Is there anyway of identifying the current sy...

Can't inherit from classes defined in an RSL?

Note: This is an Actionscript project, not a Flex project. I have class A defined in an RSL (technically, it's an art asset that I made in the Flash IDE and exported for actionscript. The entire .FLA was then exported as a SWC/SWF). I my main project I have class B, which inherits from class A. The project compiles fine, with no errors...

Changewatcher in flex3.0?how to use in below mentioned Situation

Hello to all, Please tell me about the change watcher in flex. i have a situation like, i have few canvas, on which i have to show select and unselect,(These canvas hold product thumbnail images) , so when some thumbnail is selected i have to show selection and on selecting other, i have to unselect the previously selected canvas and h...

Flash webcam access request prompt unresponsive

Hi there, I have a parent swf called Main.swf that loads a child Registration.swf via a regular loader class then adds it to the stage. This child has a webcam function that captures an image but before that happens it prompts the user for permission to allow the webcam to be turned on. The problem I'm having is that in my IDE the prom...

how can i pause FLVplayback in as3 ?

(Event.ENTER_FRAME,myFunction); function myFunction(event:Event) { if (fk.playheadTime > stopTime) { fk.pause(); } } i pause my video at stoptime it works but then when i press the play button it doesn't work.i guess the problem is my code's place.as you can see i write it in enter_frame event.how can i solve this problem?thanks f...

Handle ActionScript runtime errors

Good day! What is the best\recommended way of handling runtime errors in AS3? I mean errors that were not catched by try...catch. I'd like to log such errors and provide some handler to show user some message? May be there are some AS3-specific best practicies? Thanks! ...

Custom cursor and customized context menu in Flex

My Flex 3 application uses a custom cursor and has to show a customized context menu when the user performs a right click. The problem is the customized menu is shown only when the default arrow cursor is shown. When I change it to the custom cursor, the standard context menu appears instead of the customized one. Is there a way to hav...

Bitmap data draw method - replacing the non-present pixels with blue color

I have a Sprite which is in the shape of a Convex polygon(not rectangular). If I take its snapshot using : var bmd:BitmapData = new BitmapData(width,height); bmd.draw(someSprite,someMatrix,null,null,null); I get an image like this : Click here to see the image In this image, I have added the green boundary myself, just to ...

package error in as3

package { import flash.display.Sprite; import flash.utils.*; public class SetTimeoutExample extends Sprite { private var delay:Number = 1000; // delay before calling myDelayedFunction public function SetTimeoutExample() { var intervalId:uint = setTimeout(myDelayedFunction, delay, "Hello", "World"); } public fun...

How to set priorety of data you transfer? (So not to block other http connections) (in pair PHP<->Flash)

I have PHP script which takes some file (FLV for example) and returns it to Flash player (just opens and reads to end), and I have flash(mxml+as3) app that calls that php script in order to recive a file. Ho to make priorety of that connection so that if user goes to some other web page or dowhloads some file my pair (PHP <-> Flash) will...

DataBinding in Actionscript

What I have is a class with static properties that I want to use as images. I would like the images to be configurable at run time but still have the defaults. So the Images class looks like: package { public class Images { [Embed(source="/assets/Green-Light.gif")] [Bindable] public static var GreenLight:Class; } } And now a custom c...

how do I publish an air\swf app that will run with my as3 code as well?

Hi All, I will take advantage of the fact that this discussion is not answered yet to add some info and narrow down my problem. You can still download my project from the link below. It seems that my fla's document class in Flash Pro CS5 is not linked properly to the default application class in Flash Builder 4. What I mean is that w...