This content has been marked as final. Show 11 replies
Thank you for your answer! All is OK with your script, but I have a little next question: how can I set the levels like in the loadMovieClip("test.swf", 2)? For example if I have two swf files loaded, the second (test2.swf) covers the first (test2.swf). How can I change the order?
var swf:String = "test.swf";
var url:URLRequest = new URLRequest(swf);
var level_1:Loader = new Loader();
var swf2:String = "test2.swf";
var url2:URLRequest = new URLRequest(swf2);
var level_2:Loader = new Loader();
Thank you very much, WISION
you can use
addChildAt(level_2,1); // to position level_2 above level_1
you can also use swapChildren() and swapChildrenAt()
To add at a higher level use addChildAt.
To swap say two objects from top to bottom i.e. move a circle from beneath a square to above it...you need to use the setChildIndex and getChildIndex methods, so in the example above we would get the index of the circle and then set the squares index to the retrieved getChildIndex value:
Ok Kglad beat me to it whilst I was typing :) need to learn to speed up my typing yo!
Suppose you have a series of thumbnails on the left side, and want a click on any to load into the same container-sprite(?) to right, at larger size. I've cobbled script to do it in a very code intensive way, rewriting functions within code for each button, which is a bit insane and obviously not the way.
But it's not like doing a loadMovie into the same clip, it's instead going on top of what exists.
Also the load is ugly compared to previous Flash. You don't see the hand so you know to click, and there's a signifigant wait before it loads, even though the files are local on the computer. What's that about I wonder? And how do you unload, or should I be following swapChildren? This is a pretty basic request. It is quite stunning how difficult this has all become.
use buttonMode to enable the hand cursor and you can use removeChild() or removeChildAt() to remove an object from the display list.
thanks, will try in the morning. You're so kind!
yes, this works, removeChildAt(numChildren - 1) to keep loading images into the same space without overlap, as in