Posted By

mecsekikrisztian on 03/10/11


Tagged

top child as3 swap


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

scottwatkins
jazzy_miles
codism
shockway


AS3 swap child, moves movieclip to top of all others


 / Published in: ActionScript 3
 

  1. setChildIndex(myMovieClip,numChildren - 1)

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: mecsekikrisztian on July 5, 2011

Hi!

If your clip to order is in an another mc just use this line instead:

mc_holder.setChildIndex(myMovieClip, i)


If your clip is in an array of buttons, your aproach should be like this:

var buttonArray:Array = [btn1, btn2, btn3, btn4] for(var i:int = 0; i < buttonArray.length; i++) { buttonArray[i].addEventListener(MouseEvent.ROLL_OVER, buttonOver) }

function buttonOver (e:MouseEvent):void{ setChildIndex(DisplayObject(e.currentTarget), i) }

Happy coding! Cheers!

You need to login to post a comment.