0
votes

If I use setChildIndex to change my movieclips index position on the stage. Can I only set it to a index that already been occupied. or can I make up an index of my own. like 100. Reason being is because I am trying to figure away to make movieclips always on top. What I had in mind besides setChildIndex is...

if(eApi.getChildIndex(this) < eApi.getChildIndex(target))
                eApi.swapGameChildren(this, target);

but before I use the above, I was checking to see if there is anything better. O yea, and "swapGameChildren" is just an encapsulated swapChildren() method.

3

3 Answers

1
votes

Use yourContainer.numChildren - 1 to get the topmost index.

1
votes

If you simply do an addChild then your asset will be placed on top. So if your asset mcA us under mcB and you addChild(mcA) it will move to the top position.

0
votes

This is what I did

eApi.setChildIndex(this, (eApi.numChildren - 1));