woodscreative
woodscreative

Reputation: 1031

AS3 removing MovieClips in an array

Anybody any ideas on how to remove children from stage using AS3 if I store the reference to the objects in an array and they exist in different locations i.e they are not all children of the same parent?

SomeArray.push(this);

Upvotes: 1

Views: 2283

Answers (2)

Daniel
Daniel

Reputation: 35684

for each(var mc:MovieClip in SomeArray){
    mc.parent.removeChild(mc);
}

Upvotes: 6

loxxy
loxxy

Reputation: 13151

Consider this :

  • Iterate over each of the clips & their children.
  • Match the reference name/ID (I hope its a unique one).
  • Use removeChild to remove the display object(Sprite,MC,etc).
  • keep popping off the last reference off the array as you keep getting matches.

Upvotes: 0

Related Questions