Questions about levels

Hi… I have some code here… I’m just trying to generate some random circles to move them around as a background.

for(k=0; k<4; k++) {
duplicateMovieClip (bubble, “circle” + k, 0);
}

my question is about the levels… running that code, I only get two circles (the original one, and a new one at level 0)

If i do this, however

for(k=0; k<4; k++) {
duplicateMovieClip (bubble, “circle” + k, k );
}

I get 6 circles including the original one. My first question is… why is there a difference in the number of circles? (using the debugger I’m noticing that the second circle that’s made is named “circle3”)

my second question is - I have a navbar that I would like the circles to go behind… however, only the first circle (the bubble movie) does that. How can I make it so that all the circles go behind it?

And a bonus question - do buttons have levels? or is that just for movies? I have some buttons too that I dont want the circles to block.

first …

for (k = 0; k < 4; k ++) {
duplicateMovieClip (bubble, “circle” + k , 0)
}

you’re giving the same depth for every duplicated bubble
so it’s replaced until circle3 … which remains in the stage [size=1][ i think … lol :stuck_out_tongue: ][/size]

second …

bubble original movie clip
circle0 first duplicated circle
circle1 second duplicated circle
circle2 third duplicated circle
circle3 fourth duplicated circle

grand total = 5 :stuck_out_tongue:

me don’t understand :cyclops:

third …

place your navigation bar in a higher depth using
[color=red]instanceName.swapDepths (someNumber)[/color]

bonus …

same as third but in a lower depth … ? :stuck_out_tongue:

hope it helps :slight_smile:

just fyi lavaboy, when dealing with duplicate movie and attachMovie etc, the correct term for that kind of placement/arrangement is “depth” (like kax used) and not level. Normally it wouldnt be a big deal but Flash also deals with levels when using loadMovie/loadMovieNum which are similar but different alltogther - allowing for confusion when working with duplicate etc.

the correct term for that kind of placement/arrangement is “depth” (like [color=red]kax[/color] used) and not level

viva yo !! :stuck_out_tongue: :wink:

hey, thanks, swapdepth worked. I’m still confused about depth though… my script generates a couple of movie, but I want them to go behind preexisting buttons… Are the movies generated by the code in different depths? Can you have two movies in the same depth? Cause I didnt really understand why the movies were getting overwritten as a result of having the same depth.

can you have two movie clips in the same depth ?
nope …

when you’re talking about movies … you mean movies [size=1][ different swfs ][/size] or movie clips ?? lol :stuck_out_tongue:
if it’s movies then you’re talking about levels
if it’s movie clips then you’re talking about depths

oh well … you’ve officially confused me now :cyclops:

senocular get back here with your explanations !! :stuck_out_tongue:
you’re really good at that and i really suck :-\

yeah, its like an array if you are familiar with them if you have an array with three elements:

myArray = new Array(1,2,3);

and you try to put a new element in the second postion of that array

myArray[1] = “a”;

Then you evectively over-write and replace that original element with the new

trace(myArray); // traces 1,a,3

The same thing applies when attaching and duplicating movieclips. Trying to attach a bunch of movies in depth 0 means you are replacing each one of those clips youve previously put there.

swapDepths however, does let you swap movieclips into the same depth once theyve been successfully attached. With this though you sometimes get some flickering if they are overlaping because Flash is confused on how to arrange them on the screen randomly putting one above the other etc.

that was fast dude :stuck_out_tongue:

thank you very much …

*Originally posted by kax *
**that was fast dude :stuck_out_tongue:

thank you very much … **

haha I started before you posted yours :slight_smile:

yeah i know that … that’s why i was laughing :smirk:

:!: I thought :stuck_out_tongue: was a tongue
Im missing out on a lot of things, Im feeling dense lately haha

a tongue huh ?? … no idea

but it seems like a laughing smilie to me :slight_smile:

cool… that clarifies stuff… thanks.