views:

65

answers:

2

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
Thanks! Works perfectly
Arms
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