For those of you who, like me, use timeline coding (as opposed to OOP) but still want to take advantage of the speed of AS3, the main problem in switching over has been the lack of a _root equivalent. I've spent hours researching it and finally found a really simple solution on the Kirupa forums. Here's how it works.
Step 1
Create a new actionscript file called ro.as, and copy the following code into it.
package {
import flash.display.MovieClip;
public dynamic class ro extends MovieClip {
public static var ot:MovieClip;
public function Ro() {
ot = this;
}
}
}
Be sure to save it in the same directory your .fla file is in.
Step 2
On the stage properties panel (make sure nothing is selected on the stage and you'll see it) in the Document Class field, type "ro" without parethesies.
Step 3
You can now access the root just like in AS2! The only difference is, instead of typing "_root.VariableName" you now type "ro.ot.VariableName".
How It Works
AS3 was reformulated using DisplayObjects, and because of this the root variable no longer always refers to the stage and main timeline. (It seems like it usually doesn't, actually...). So we basically have to make our own root. To do this, we make a movieclip, and put the whole flash inside of it (which is what the class is doing). That way, all of the stuff we do on the main timeline and stage can be accessed globally. By typing ro.ot, you're first defining the class name (ro) and then the movieclip name (ot).