# Swap Depths

**URL:** https://forum.kirupa.com/t/swap-depths/62616
**Category:** flash
**Created:** [August 30, 2004, 12:30am UTC](https://forum.kirupa.com/t/swap-depths/62616 "2004-08-30T00:30:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Skinny\_T](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Skinny\_T](https://forum.kirupa.com/u/Skinny_T)
#### Post date: [August 30, 2004, 12:30am UTC](https://forum.kirupa.com/t/swap-depths/62616/1 "2004-08-30T00:30:04Z")

</div>

I’m using this code:  
on(press){  
\_root.myDepth++;  
\_parent.swapDepths(\_root.myDepth);  
}  
and it works fine but it keeps sends it above the other higher layers on my scene, How can I prevent this?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 30, 2004, 12:33am UTC](https://forum.kirupa.com/t/swap-depths/62616/2 "2004-08-30T00:33:37Z")

</div>

by setting an initial value for myDepth as somewhere near the start of the depths range (think its about -16,000 as opposed to the initial value it will automatically create with that script, 0 (which is above about 16,000 other layers ;))  
do a search for the range, sen posted them in flash mx limitations thread somewhere  
or use a trace for \_parent.getDepths()

Prophet.
