# On press drag two movie clips?

**URL:** <https://forum.kirupa.com/t/on-press-drag-two-movie-clips/113135>\
**Category:** Uncategorized\
**Created:** [June 15, 2004, 11:29am UTC](https://forum.kirupa.com/t/on-press-drag-two-movie-clips/113135 "2004-06-15T11:29:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ejrob](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@Ejrob](https://forum.kirupa.com/u/Ejrob)\
**Post date:** [June 15, 2004, 11:29am UTC](https://forum.kirupa.com/t/on-press-drag-two-movie-clips/113135/1 "2004-06-15T11:29:02Z")

</div>

Hi  
I have a magnifier made of two movieclips, glass\_mc and handle\_mc. The glass\_mc is a mask revealing an image in a layer below.  
Now I want the handle to move like this:  
on (press) {  
startDrag(handle\_mc, false);  
}  
on (release) {  
stopDrag();  
}  
(See attached example)  
But this script can only take care of one movieclip. I want the glass\_mc to follow as well,  
Hope someone can explain how it should be done.  
//Ejrob

---

<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:** [June 15, 2004, 5:38pm UTC](https://forum.kirupa.com/t/on-press-drag-two-movie-clips/113135/2 "2004-06-15T17:38:07Z")

</div>

it can be done. use-\>  
[AS]  
on(press){  
mouseX=\_root.\_xmouse  
mouseY=\_root.\_ymouse  
diffX=\_x-mouseX  
diffY=\_y-mouseY  
pressed=true  
}  
on(release,releaseOutside){  
pressed=false  
}  
onClipEvent(enterFrame){  
if(pressed){  
\_x=\_root.\_xmouse+diffX  
\_y=\_root.\_ymouse+diffY  
\_root.glass\_mc.\_x=\_root.\_xmouse+diffX  
\_root.glass\_mc.\_y=\_root.\_ymouse+diffY  
}  
}  
[/AS]  
hope that helped. 🙂

---

<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:** [June 16, 2004, 6:23am UTC](https://forum.kirupa.com/t/on-press-drag-two-movie-clips/113135/3 "2004-06-16T06:23:53Z")

</div>

Yes it certainly did, thanks a lot.  
Would it be too much to ask for an explanation how and why it works?
