views:

40

answers:

2

I'm trying to get an actionscript code used in a Flash CS5 example and make a ActionScript class using it in Flash Builder. And I'm trying to understand the _root property.

This page have a brief explanation about the _root property, but it is too vague.

My question is: What is the "_root" that exists only when the ActionScript is placed in the Flash CS5 project? How do I reference it in my class in Flash Builder? (it is an instance of what?)

+1  A: 

http://www.kirupa.com/forum/showthread.php?p=1952513

I can't think of a better explanation of stage vs. root and what each means.

Tegeril
Cool. Could you copy the text here? (as maybe the link change in the future, and we lose it)
Tom Brito
Kirupa is not going anywhere, that post was made in 2006. That and the text is -huge-
Tegeril
A: 

I think you may have a wire crossed - there is no such thing as _root in AS3. In AS1/AS2, _root was basically a global variable pointing to the stage (it's actually a little more complicated, since AS2 had a slightly messy way of organizing display objects).

In AS3, the closest analogy is the stage property, but actually due to AS3's robust way of managing the display hierarchy you don't actually need to use stage very often. Anyway, for AS3 programming the only time you ever need to think about a _root is if you load in an AS2 SWF (which you should probably avoid if you can).

fenomas