# Drag'n'drop bring to front doesn't work (couldn't find a solution anywhere)

**URL:** <https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314>\
**Category:** Uncategorized\
**Created:** [August 25, 2003, 4:50pm UTC](https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314 "2003-08-25T16:50:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToyFiger](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/toyfiger/32/318_2.png) [@ToyFiger](https://forum.kirupa.com/u/ToyFiger)\
**Post date:** [August 25, 2003, 4:50pm UTC](https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314/1 "2003-08-25T16:50:38Z")

</div>

Sorry to start this topic again but i couldn’t find a solution for my prob anywhere in the forum or the tut-pages.

i want to achieve what kirupa explaines in his [swap depth tutorial](http://www.kirupa.com/developer/actionscript/swapdepth.htm), i want the visitor to drag different objects + the one selected comes to the front.

i did everything explained in the tutorial, but there is one difference: i don’t want the draggable area to be the whole MC wide, that’s why i placed a button into a MC. this button should have the dragging actions and drag the whole clip.  
so far it works, but the MC wouldn’t be brought to front, although i typed the correct path:

```auto

on (press, release, dragOver, dragOut) {
    _root.x += 2;
    _root.txt2.swapDepths(_root.x);
}
on (press) {
    startDrag(this, false, -448, -170, -66, 310);
}
on (release) {
    stopDrag();
}

```

this sounds all pretty complicated, you’ll probably get my point when seeing [the actual swf](http://mitglied.lycos.de/wardema/drag-and-bring-to-front.swf)

thanks in advance for any suggestions

---

<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 25, 2003, 4:55pm UTC](https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314/2 "2003-08-25T16:55:24Z")

</div>

Yes, I can see the problem, but it would be better if you could give us a link to the FLA… 😉

However, I think you don’t need to increment a variable everytime you click on a MovieClip. You could simply set a depth level, say 100, and use this code:  
[AS]on (press) {  
this.swapDepths(100);  
startDrag(this, false, -448, -170, -66, 310);  
}  
on (release) {  
stopDrag();  
}[/AS]

---

<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 25, 2003, 5:13pm UTC](https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314/3 "2003-08-25T17:13:06Z")

</div>

this wouldn’t help either,  
try the [fla](http://mitglied.lycos.de/wardema/drag-and-bring-to-front.fla) if you like then 🙂

---

<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 25, 2003, 5:23pm UTC](https://forum.kirupa.com/t/dragndrop-bring-to-front-doesnt-work-couldnt-find-a-solution-anywhere/29314/4 "2003-08-25T17:23:08Z")

</div>

Ok.

You forgot to give an instance name to the MovieClips! 😛  
[AS]on (press) {  
\_parent.swapDepths(100);  
startDrag(this, false, -448, -170, -66, 310);  
}  
on (release) {  
stopDrag();  
}[/AS]  
That would do though.
