Skip to main content
April 10, 2008
Question

Bring layers to top

  • April 10, 2008
  • 1 reply
  • 349 views
I'm wondering how to bring layers to the top in actionscript 3.

I've created many "boxes" using the addChild function as follows:

for(i=0;i<40;i++){
var b:MovieClip = new box();
stage.addChild(b);
b.addEventListener(Event.ENTER_FRAME, boxChange);
}

The boxes scale larger and overlap according to mouse position and the movieclips that were created later always overlap the ones created previously. How do I bring a desired box to the front?

Thanks!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 10, 2008
you can use the addChildAt(), removeChildAt(), setChildIndex() and swapChildrenAt() methods of the displayobjectcontainer class.