I have a "box_mc" movieclip on the root of my stage and I need to select it from within my Document Class. I thought Stage.getChildByName("box_mc") would work, but it just returns null. Thanks in advance.
+3
A:
in your document class, in the constructor add
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
then in the function init:
private function init(e:Event):void
{
getChildByName("box_mc")
}
Allan
2010-01-07 04:08:28
Thanks! Works perfectly
Arms
2010-01-07 04:13:09
A:
Well, assuming you're automatically declaring stage references (on by default, so unless you turned this off you're fine) then all you have to do is type box_mc.
In your document class constructor just type trace(box_mc) and it should work.
Myk
2010-01-07 15:20:50