Skip to main content
Participant
March 23, 2011
Answered

Can you do this: myMC.getChildAt(3).addChild(imgLoader);

  • March 23, 2011
  • 1 reply
  • 514 views

     Flash is throwing errors when I try it. "Scene 1, Layer 'Layer 3', Frame 1, Line 177    1061: Call to a possibly undefined method addChild through a reference with static type flash.display:DisplayObject."

    How could I do this without knowing the name of the child, only the number?

          Thsi is what I tried: myMC.getChildAt(3).addChild(imgLoader);

This topic has been closed for replies.
Correct answer kglad

cast that child as a displayobjectcontainer:


DisplayObjectContainer(myMC.getChildAt(3)).addChild(imgLoader);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
March 23, 2011

cast that child as a displayobjectcontainer:


DisplayObjectContainer(myMC.getChildAt(3)).addChild(imgLoader);