Arranging MC's

hi,

ok so i have 3 MC’s on the main stage i was just wondering if it’s possible to pull which ever MC to the front when it’s clicked, like you would arrange them if you click ‘Bring To Front’.

All the MC’s are at the same position on the page so when button 1 is clicked mc 1 is at the front, button 2 mc 2…and so on?

does that make sense?

thanks

If your movie clips are loaded into levels, you can use

whatever_mc.swapDepths(instanceName_to_swap_with)
or
whatever_mc.swapDepths(6) //put the depth level instead of 6

If you need 3 MC’s, you are going to need a swapping variable. So when you click the MC, set up the onRelase function to “swap depths” thing, and then change a variable, so you know which MC is on top to swap with.


//this goes in the main MC timeline
var onTop = "MC1"

//put this in your MC1 loaded movie
whatever.onPress = function () {
_root.MC1_container.swapDepths(onTop+"_container");
_root.onTop = "MC1"
}

//this goes in MC2 loaded movie
whatever2.onPress = function () {
_root.MC2_container.swapDepths(onTop+"_container");
_root.onTop = "MC2"
}


That’s the gist of it. If you got any other questions, post. Good Luck!

i tried doing what you said but i don’t think i did it right…

i’ve attached the most simple of fla’s with 3 mc’s and 3 buttons in it, each is a different colour so you click the relavant colour to pull it to the front, if you have time could you apply the code in the right places?

i’m not totally sure what i’m doing cause im still abit of a novice :crying:

ok, thanks

i tried doing what you said but i don’t think i did it right…

i’ve attached the most simple of fla’s with 3 mc’s and 3 buttons in it, each is a different colour so you click the relavant colour to pull it to the front, if you have time could you apply the code in the right places?

i’m not totally sure what i’m doing cause im still abit of a novice

ok, thanks

so you don’t have loaded movies??

just paste this code into a frame:


button1.onPress = function () {
mc1.swapDepths(1);
}

button2.onPress = function () {
mc2.swapDepths(1);
}

button3.onPress = function () {
mc3.swapDepths(1);
}

pretty easy. I generally use a layer called “code” that I can put blank MC’s on with AS. Create that and put the code on the first frame in that layer.

that simple ey?

thanks for you help man :slight_smile: