[FMX] swapDepths, depth problem

I just started learning actionscript, so easy on the die hard terms :wink:

Here’s an image:

Here’s the action attached to the MCSlang MC:


on (rollOver) {
_root.MCSlang.gotoAndPlay(“FOut”);
}
on (rollOut) {
_root.MCSlang.gotoAndPlay(“FIn”);
}
on (release) {
_root.diepte +=1
_root.MCBGSlang.swapDepths(_root.diepte);
_root.MCSlang._visible = 1;
_root.MCHage._visible = 1;
_root.MCSchild._visible = 1;
_root.MCKrok._visible = 1;
switch (_root.exitdier) {
case undefined :
_root.MCBGSlang.gotoAndPlay(“Start”);
break;
case “exitslang” :
break;
case “exithage” :
_root.MCBGSlang.gotoAndPlay(“Start”);
_root.MCHage.gotoAndPlay(“FIn”);
break;
case “exitschild” :
_root.MCBGSlang.gotoAndPlay(“Start”);
_root.MCSchild.gotoAndPlay(“FIn”);
break;
case “exitkrok” :
_root.MCBGSlang.gotoAndPlay(“Start”);
_root.MCKrok.gotoAndPlay(“FIn”);
break;
}
_root.MCSlang._visible = 0;
_root.exitdier = “exitslang”;
}

I’m using a script I found here, on kirupa to swap the backgrounds (MCBGSlang/MCBGHage, …). I used swapDepths because the background fades in, and I want it to fade in from the previous selected animal/background.

Now, the problem is, the backgrounds are in front of EVERYTHING!

How do i keep it where it should be – in the background? Without too much hocup pocus of course :wink:

tia!

Hi,

I had some problems with swapdepths too. Try to trace the getdepth() and see wath’s the depth of the background and then maybe try background.swapDepths(depthNumber);

ne chance of an fla to work with??

Prophet.

I tried some with getDepth() – didn’t even know it existed until you told it :slight_smile:

The backgrounds are at -16364 (snake-“slang”) and -16360 (lizard - “hage”).
-16384 is the deepest i read somewhere?
When they get above -16355 (=> -16354, -16353, …) they get in front of the white border.

So far I’ve only made the buttons (= the animals), but I wanna be sure that any other content won’t disappear when you’ve clicked a few times on the animals …

btw, now when i preview (ctrl-enter), and then I close the preview, Flash crashes. EVERY time. I never had this problem before …

I’m not putting the .fla online since i change it about every minute :wink:

bump

ne chance of an fla to work with??

Prophet.
it doesnt have to be an uptodate fla, just 1 we can work on to solve this

Prophet.