views:

68

answers:

1

Is it possible to change the order of layers in a Flash MovieClip timeline using ActionScript 3?

+1  A: 

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.

djrsargent
Yarin