In AS2 was easy to change a value from a variable that was in other timelines. Now I can't do it the old way!
Basically what I need is to change a value from a variable that is in the main timeline, from another timeline.
var totalA:int = 0;
Other timeline, after adding the eventListener to the function:
So it doesn't work. Can anybody explain why? Thanks
Flash Player 10 real-time audio playback
Inherited Classes and Dynamic Views in PureMVC (AS3)
Flash Player deep linking problem
Created a MovieClip with the path:.
AS3 DAE Augmented Reality PaperVision 3D
Then i referenced it:.
var A_mc:MovieClip = MovieClip(this.parent.parent);
How do I animate a sprite?
Why check boxes do not stayed checked as you scroll using flex?
Adobe AIR detect if Running in ADL?
AMFPHP vs ZendAMF
you reference it from all your classes and can set variables in it that are accessible everywhere.. take a look at http://www.uza.lt/codex/as3-global-object/ . Global Object is a Singleton that lets you store dynamic variables in a globally accessible location within your AS3 application.
This enables developers to accomplish things like self registering visual components, global events and event listeners..
It helps to encapsulate that variable inside the function.
You should name your function something meaningful, for example:.
This way all the function for figuring out the total is encapulated within the Singleton and the function.
function addToTotal (int amount) :void
If somehow the way you need to total changes later or if you need to change the varialbe, the change is limited to the function..
If you are not familiar with the singleton design pattern, merely stick to casting it as .
//Example - Would move the parent movie clip 5 pixels to the right.
//You must cast it because there is no way for the compiler to know what the asset.
MovieClip(parent).x = 5;