R – using setChildIndex();

actionscriptactionscript-3flash

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.

Best Answer

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

Related Topic