Adding objects to the top of the display list and keeping them there
I'm working on a actionscript 3 flash file wherein I want to use multiple .swfs to load at various points.
I'm using the loader class and addChild开发者_StackOverflowAt to add these swf files to the display list. However, I'd like to keep one or more files above everything else, and have the rest of the swf files load directly under the top most swf files.
Is there any way to keep an object or loaded swf on top of the display stack? Or is there any way to get actionscript 3 to work like actionscript 2, where I could just load these objects into much higher levels?
Why not create two Sprite/Movieclip containers, containerBottom and containerTop, at depths 0 and 1 respectively? Add all the content you want to stay on top into containerTop and add all the content you want below into containerBottom. Then the only thing you'll have to keep track of is the depths of your content within these respective containers.
To keep a child at the top, you could use like swapChildren(mc, getChildAt(numChildren - 1));
You could write a component that would load things where you want them. But that would just use the technique that you're already using. What's the problem with it?
精彩评论