set and get variables throughout moive - actionscript 3
- by ed209
I need to set various variables depending on what a user clicks. Those variables then need to be accessed by other movieclips.
The problem is that at the time of clicking, those "other movieclips" don't exist on the timeline yet.
What I have done is assign the variable to the parent movieclip, although I guess I could just as easily set them to the root. Then I would grab that value when the relevant clip is initiated.
// set - works
MovieClip(parent).aMovieClip.someVariable = myVal;
// get? - doesn't work
getVar = MovieClip(parent).aMovieClip.someVariable;
the above doesn't work - what is the correct way to get that value whenever I need it. I guess it's a case of getting and setting global variables