Help ,SetChildIndex over movieclips not working properly..
The problem is simply,
the code which works over stage, is not working properly over a movieclip..
sample, i have many objects to stay at different indexes at flash..
with that code block below. I add 300 mc's to stage,
Code:
for (var j:Number = 0; j<300; j++) {
var mc2:MovieClip = new MovieClip();
stage.addChildAt(mc2, j);
}
TO be able to change indexes with different items.. i have random movieclips which have to be placed indexes between 5 and 300.. And everything goes great when i do this directly at stage..
But when i do this with a movieclip.. example;
Code:
for (var i:Number = 0; i<300; i++) {
var mc3:MovieClip = new MovieClip();
my_mc.addChildAt(mc3, i);
}
i can't see the movieclips inside.. but i know they are at their right indexes..
but somehow they are getting behind those fake movieclips..
What might the reason be? Does anyone have any idea HELP PLEASE...
Any effort will be appreciated :P
Note: the layer is at the highest position which i use..
1 Attachment(s)
Actually you re not missing something..
Quote:
Originally Posted by
caseyryan
It should work actually. Have you added my_mc itself to stage?
Or am I missing something? Why do you need to change these indexes to random ones?
I think this attached example will explain anything.
The active code block is working without any problems,
but the commented part, ( only difference is the objects.. one of them is using stage the other is using MovieClip called mmc )
U can check it.. Actually indexes not random, they re known but programatically i don't know themm :P
If you can please test the example.. u will get it..
below is the also codeblock.
And thank you for your reply.
Code:
var ldr:Loader;
/* Without stage..
for (var k:Number = 0; k<300; k++) {
var mc4:MovieClip = new MovieClip();
mmc.addChildAt(mc4, k);
}
ldr = new Loader();
ldr.load(new URLRequest("cloth.png"));
mmc.addChildAt(ldr,5);
ldr = new Loader();
ldr.load(new URLRequest("jacket.png"));
mmc.addChildAt(ldr,10);
ldr = new Loader();
ldr.load(new URLRequest("pants.png"));
mmc.addChildAt(ldr,15);
*/
/*
With Stage
for (var k:Number = 0; k<300; k++) {
var mc4:MovieClip = new MovieClip();
stage.addChildAt(mc4, k);
}
ldr = new Loader();
ldr.load(new URLRequest("cloth.png"));
stage.addChildAt(ldr,5);
ldr = new Loader();
ldr.load(new URLRequest("jacket.png"));
stage.addChildAt(ldr,10);
ldr = new Loader();
ldr.load(new URLRequest("pants.png"));
stage.addChildAt(ldr,15);
*/