Copy link to clipboard
Copied
How do I move a movie clip to top? I have 4 clips on stage and they alpha in and out. WHen one is at alpha 100% I want it to be above all the other is this possible?
Copy link to clipboard
Copied
Say your movie clips are mc1, mc2,mc3,mc4
now call following snippet...(for now say I want mc4 to be on top)
mc4.parent.addChild(mc4);
ASSUMPTION: all the movie clips are in the same container i.e. mc1.parent == mc2.parrent == mc3.parent == mc4.parent
Copy link to clipboard
Copied
Using addChild() will bring something to the top, so for a movieclip named "mc" (or a variable "mc" that points to the movieclip) you can say this:
mc.parent.addChild(mc);
and now mc will be on top of everything else that is in the mc's parent level.
Copy link to clipboard
Copied
I used this code:
function moveToTop( clip:DisplayObject ):void{clip.parent.setChildIndex(clip, clip.parent.numChildren-1);}
My clips exist on stage and tween in I'm not sure how the addChild would work? I prob could have set it all up differently.
Copy link to clipboard
Copied
There would be no difference between your setChildIndex(clip,clip.parent.numChildren-1) and just using clip.parent.addChild(clip).
Copy link to clipboard
Copied
sweet. Thanks!