Moving From Flash AS2 to Flash AS3: _root

_root Versus root

Before ActionScript 3.0, the _root variable call referred to the timeline of the original host SWF no matter how many SWFs were previously loaded.  I have always saw it as the bail out plan, because no good ever came from _root is AS2.  Since _root can easily be compared to an absolute address, the long term effects will be felt especially as your code becomes more object-oriented.

In ActionScript 3.0, the root instance of the SWF loaded into a player represents the first instance of the stage.  The hardest concept about the newly redefined root is that it does not always refer to the main timeline.  Instead, it refers to the main level of the display object.

For example, a MovieClip’s root will work the same if it were loaded into a swf or stood alone within a main SWF.  Having some knowledge on how the new display list with AS3 works will help understand this concept better.

Hopes this info helps in your quest to learning AS3.

Further Reading:

If you are still utterly confused or would like more info on this topic, be sure to check out Senocular’s forum post: Access to stage and root.  Also, if you haven’t already, you have got to get your hands on Learning ActionScript 3.0: A Beginner’s Guide.

One thought on “Moving From Flash AS2 to Flash AS3: _root

Comments are closed.