Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrange (z) order of objects in Flash with ActionScript 3?

Is it possible to arrange (z) order of objects in Flash with ActionScript 3?

e.g. I have 3 symbol instances on a given layer, and I want to perform the equivalent of 'Bring to Front', 'Bring Forward', and/or target a certain z position.

like image 204
Yarin Avatar asked Oct 05 '10 15:10

Yarin


1 Answers

You can change the z-index (stacking order) of a movie clip within a same layer using action script like this.

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.

like image 148
djrsargent Avatar answered Oct 26 '22 14:10

djrsargent