0

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.

Steven Mercatante
  • 24,757
  • 9
  • 65
  • 109

2 Answers2

3

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
  • 3,339
  • 2
  • 21
  • 24
0

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
  • 6,205
  • 4
  • 26
  • 33