# Swapdepth problem...sorry

**URL:** https://forum.kirupa.com/t/swapdepth-problem-sorry/136505
**Category:** Uncategorized
**Created:** [February 5, 2005, 4:41pm UTC](https://forum.kirupa.com/t/swapdepth-problem-sorry/136505 "2005-02-05T16:41:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imported\_invisiblelo](https://avatars.discourse-cdn.com/v4/letter/i/da6949/32.png) [@imported\_invisiblelo](https://forum.kirupa.com/u/imported_invisiblelo)
#### Post date: [February 5, 2005, 4:41pm UTC](https://forum.kirupa.com/t/swapdepth-problem-sorry/136505/1 "2005-02-05T16:41:58Z")

</div>

i have got 3 movieclips on the stage, they all can be dragged etc. So I have placed the swapdepth script with each clip (clip6, clip4, clip1), code below:

onClipEvent (mouseDown) {  
if (\_root.clip6.hitTest(\_root.\_xmouse,\_root.\_ymouse,true)){  
\_root.clip6.startDrag (false, left, top, right, bottom);  
// this.dragging = true;  
\_root.clip6.fadeit = true;  
\_root.x +=2;  
\_root.clip6.swapDepths(\_root.x);  
}  
}  
onClipEvent (mouseUp) {  
\_root.clip6.stopDrag ();  
// this.dragging = false;  
\_root.clip6.fadeit = false;  
}  
onClipEvent (mouseMove) {  
if (\_root.clip6.fadeit) {  
\_root.clip6.clip5.\_alpha -= 1;  
}  
}  
onClipEvent (load) {  
top=\_y-1000;  
bottom=\_y+1000;  
left=\_x-1000;  
right=\_x+1000;  
}

My only problem is when you have all 3 clips overlapping and you click the back clip it comes forward and brings whatever clip it is touching forward as well, any ideas?

Thanks
