Change order of layers in Flash MovieClip with ActionScript?
Is it possible to change the orde开发者_开发百科r of layers in a Flash MovieClip timeline using ActionScript 3?
You cannot change the layer order, but you can change the z-index (stacking order) of a movie clip within a same layer. So you can consolidate all the relevant movie clips into one layer, then change the z index using acrtionscript.
parent.setChildIndex(childObject, i)
Change childObject to the name of the movie clip you want to change the z-index, change i to an integer (the desired z-index value).
If you want to make this happen on a mouse event, put above code inside a function and attach an event listener to a button to invoke this function on a mouse event.
精彩评论