I am not sure that this is the best or only way of doing it.. but here's what I found so far
what used to be _root.mcName in AS2 is gone... and now the while concept of root is also gone
according to Adobe (from the Flash CS3 help file)
the
property is the top-most display object in the portion of the display list's tree structure represented by that SWF fileroot
however, if you have an object on the stage with name chalk for example you can't access it by saying: root.chalk
because root is the parent displayObject of a stage, where objects are added.
so, on the document class or on the frames, if you write:
var chalk = new Chalk(); chalk.name = "chalk"; stage.addChild(chalk);
the way to access the chalk object from a child class is by writing:
var _ch = root.stage.getChildByName("chalk");
one thing to keep in mind is: every object you add to a display list has a root of its own.. which shows in the example that Adobe provided with the flash help file:
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;trace(stage.root); // [object Stage]
var ldr:Loader = new Loader();
trace(ldr.root); // null
addChild(ldr);
trace(ldr.root); // [object ...]
var urlReq:URLRequest = new URLRequest("example.jpg");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void {
trace(ldr.content.root); // [object Bitmap]
}
more on that later.