Actionscript 3.0
In previous version of Actionscript, you could access variables by specifying levels or simply declaring them in the root. That said, if you were inside a movieclip and wanted to access a root variable, then you would simply type _root.
to access it.
In Actionscript 3.0, it is a bit different.
To access a root variable from inside a movieclip, the syntax is:
MovieClip(root).
Example:
In root I declare a variable:
var myVar:int = 10;
In movieclip:
MovieClip(root).myVar = 20;
This would change the value to 20, but obviously you could do whatever you would like to the variable.
Keywords: Accessing root variables from a movieclip AS 3.0 Flash
Comments