Flash variables hold information usually numbers, letters (string), or true/false data (boolean) . Recently I’ve been working on a project that uses many vars to pass, store, and retrieve information. I soon realized that the variables were only accessible with actionscript in the timeline they were created in, unless you give a path to the variable in the actionscript.
For example, if you were writing code inside a movieclip on your main timeline, and you wanted to access a variable inside another movieclip on the main timeline, you would write the code something like this:
_parent.mcInstanceName.variable or _root.mcInstanceName.variable
This can get fairly complex quickly when you are using loadMovie or loadMovieNum to place another swf inside a container MC. That’s why I find it very useful to use the trace command when testing a path to make sure that the variables are doing what you want.
Here’s an example of using trace to show a variable’s value:
trace(_root.mcInstanceName.variable);
I hope you found this information useful. Thanks for visiting my blog!
I also wanted to let you know that now through Christmas I’m running a web design special: