views:

171

answers:

1

Here is the problem I have: after I change the index of one movieclip using this code

oldIndex=getChildIndex(DisplayObject(e.target));

setChildIndex(DisplayObject(e.target), numChildren - 1);

when I give the object its old index

setChildIndex(DisplayObject(e.target), oldIndex);

and go to another frame of the movie, this element I have changed the index of stays on top of all elements on the new frame.

My question is am I doing something wrong and if not, what can I do so that this element stays only in the frame it is placed.

+2  A: 

every time you load a frame you reset the elements to the appearance they have in the frame. either you need to stick to frame based, or code based animation, otherwise you need to create an array or such that contains the order of the objects, then every time you change the frame, scan the array and assign the objects to the relevent indexes.

shortstick