views:

21

answers:

1

Hi,

Hi my designer made a fla file where he has animated layers loads of them. All the images inside those animations are loaded from outside the swf.

Now, the issue is at one point in time I want some of the objects to go under another object ( current their on top) . If I do this visually the images inside the swf(loaded) are lost.

Any ideas?

Fahim.

+1  A: 

Hi Fahim,

In AS3 you can re-parent a DisplayObject by using

newParent.addChild(myMC);

The great thing about this way in AS3 (as opposed to AS2) is that the depths are taken care of automatically.

An easy way to move a clip to the top (if there are multiple clips attached to the same parent) is just call myParent.addChild(myClip). You can do this even if it is already a child of myParent, and doing this will just move myClip to the top of the stack.

So to solve your dilemma, you should be able to use this method to move your topmost clip to the top of the stack before you need the others to go under it.

danjp
so basically my animator works on say five layers, with the same hierarchy. When I need to change it, I just addchild through actionscript and then remove child when I want it to go back?
Fahim Akhter
removeChild will remove it from the display list. To move it back to another clip you need to do something like this(move to holder2)holder2.addChild(myClip);(to move back to holder1)holder1.addChild(myClip);
danjp