Text 3 Jan AS3 Notes 0001

Accessing main timeline variables from MovieClip in AS3:

While working on my game, I stumbled across the same AS3 problem I had a while ago but was never solve. I googled and searched through tons of results and finally found the perfect one which works in AS3:

  • MovieClip(root).jakel168

or

  • MovieClip(parent).jakel168

Replace “jakel168” with either the variable or the movie clip you want to access from the stage.

This should be the AS3 format of AS2’s “_root.”. I used “_root.” in my AS3 script previously, it works, but my lecturer said that it was considered to be “cheating” in Flash, and not really professional for any ActionScript-ers to do that.


Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.