# \[FMX\] swapDepths, depth problem

**URL:** <https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337>\
**Category:** Uncategorized\
**Created:** [August 13, 2004, 4:14pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337 "2004-08-13T16:14:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoGood](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NoGood](https://forum.kirupa.com/u/NoGood)\
**Post date:** [August 13, 2004, 4:14pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/1 "2004-08-13T16:14:30Z")

</div>

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

Here’s an image:  
 ![](http://fkserv.ugent.be/lombrosiana/flash.jpg)

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 😉

tia!

---

<div class="post-metadata">

**Author:** ![asthyanax](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asthyanax](https://forum.kirupa.com/u/asthyanax)\
**Post date:** [August 13, 2004, 4:36pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/2 "2004-08-13T16:36:03Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![Prophet](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@Prophet](https://forum.kirupa.com/u/Prophet)\
**Post date:** [August 13, 2004, 6:21pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/3 "2004-08-13T18:21:50Z")

</div>

ne chance of an fla to work with??

Prophet.

---

<div class="post-metadata">

**Author:** ![NoGood](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NoGood](https://forum.kirupa.com/u/NoGood)\
**Post date:** [August 13, 2004, 10:01pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/4 "2004-08-13T22:01:38Z")

</div>

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

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 😉

---

<div class="post-metadata">

**Author:** ![NoGood](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NoGood](https://forum.kirupa.com/u/NoGood)\
**Post date:** [August 16, 2004, 2:44pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/5 "2004-08-16T14:44:12Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![Prophet](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@Prophet](https://forum.kirupa.com/u/Prophet)\
**Post date:** [August 16, 2004, 6:25pm UTC](https://forum.kirupa.com/t/fmx-swapdepths-depth-problem/119337/6 "2004-08-16T18:25:58Z")

</div>

> 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.
