# Detect drag

**URL:** <https://forum.kirupa.com/t/detect-drag/21247>\
**Category:** Uncategorized\
**Created:** [May 19, 2003, 4:12pm UTC](https://forum.kirupa.com/t/detect-drag/21247 "2003-05-19T16:12:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [May 19, 2003, 4:12pm UTC](https://forum.kirupa.com/t/detect-drag/21247/1 "2003-05-19T16:12:16Z")

</div>

I have setup a button so that when i press it , it drags this movieclip and when i release it stopsdrag… what i wanan do is… detect if the movieclip has been draged or not… like how do i pass set a variable when a movie clip has been draged…

so far ive set it up soo that when i press the button it sets a variable… but a user might just press the button and not drag the movieclip i wanna set the variable not when the button is pressed but when the movie clip has actually been draged… ?

---

<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:** [May 19, 2003, 4:22pm UTC](https://forum.kirupa.com/t/detect-drag/21247/2 "2003-05-19T16:22:50Z")

</div>

Check my attachment. It has commented code of what I think you are trying to achieve.

---

<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:** [May 19, 2003, 4:24pm UTC](https://forum.kirupa.com/t/detect-drag/21247/3 "2003-05-19T16:24:57Z")

</div>

Here is another version that when you drag it it resets the \_x position so that it detects yet again whether it has been dragged or not. This allows you to check more than once if it was dragged if you wanted to.

---

<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:** [May 19, 2003, 4:50pm UTC](https://forum.kirupa.com/t/detect-drag/21247/4 "2003-05-19T16:50:19Z")

</div>

dude thanks for ur help… that helped tonnez.,… i feel soo dumb… why dint i think of that… heheh 👁

---

<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:** [May 19, 2003, 6:33pm UTC](https://forum.kirupa.com/t/detect-drag/21247/5 "2003-05-19T18:33:06Z")

</div>

I guess it could be an easy thing to overlook. It all depends on the way you approach your problem. I just thought to myself that if the position wasn’t in the original position then it was dragged, so I took that thought and put it into AS. I usually like to think of my situation in words before I put it into script. It makes things easier sometimes.
