开发者

AS3: Element stays on stage after manipulating the index(depth)

After I change 开发者_如何学编程the index of one movieclip using

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜