# Draggable movieclip won't work

**URL:** <https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036>\
**Category:** flash\
**Created:** [August 29, 2002, 3:17pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036 "2002-08-29T15:17:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aikido](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Aikido](https://forum.kirupa.com/u/Aikido)\
**Post date:** [August 29, 2002, 3:17pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/1 "2002-08-29T15:17:00Z")

</div>

I have a movie with a draggable movieclip. It works, when I preview the movie, and save it as an swf file itself.  
But when I load it through another .swf file for some reason the movie clip isn’t draggable. Here’s the code that I’m using now.

on (press) {  
startDrag("\_root.formmail", false, 110, 200, 618, 200);  
}  
on (release) {  
stopDrag();  
}

Is there something else I have to add in the actionscript?

---

<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 29, 2002, 3:32pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/2 "2002-08-29T15:32:39Z")

</div>

As far as i know you have to create a button inside the MC. Put the on press, start drag and on release, stop drag code on the button.

---

<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 29, 2002, 4:19pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/3 "2002-08-29T16:19:56Z")

</div>

yes, it’s a button. and that’s the code. but for some reason it doesn’t work.

---

<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, 2002, 9:36am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/4 "2002-08-30T09:36:24Z")

</div>

its the "\_root " think. Try using this or nothing at all and see if that works, I was just doing this tonight, and I think \_root. might just be the \_root.ofyourproblem…

shoots self for such an awful pun.

---

<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, 2002, 9:43am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/5 "2002-08-30T09:43:09Z")

</div>

Buddy, that’s \<I\>bad\</I\>. 🙂

But I’d agree. Take out the full name, just use nothing. Or ‘this’ at a push.

---

<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, 2002, 11:03am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/6 "2002-08-30T11:03:05Z")

</div>

What no one likes “\_parent”?? 🙂

if the button is inside a movie clip which you wish to drag the code would be this.

on (press) {  
startDrag("\_parent", false, 110, 200, 618, 200);  
}  
on (release) {  
stopDrag();  
}

if that doesn’t work (because I’m not sure if \_parent will work alone) you can try this…

on (press) {  
startDrag("\_parent.\_parent.formmail", false, 110, 200, 618, 200);  
}  
on (release) {  
stopDrag();  
}

Now… there is a matter of those restrict movement numbers. I dont’ know if startDrag uses global or local locations to restrict so you might end up needing to change those… probebly not… but if you notice the object moves all over the place, or to a place where you don’t want it to be… that’s probebly the reason.

---

<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, 2002, 11:53am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/7 "2002-08-30T11:53:09Z")

</div>

I would just use

on(press)  
{  
startDrag("", false);  
}

always works for me.

---

<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, 2002, 12:22pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/8 "2002-08-30T12:22:20Z")

</div>

how can that work? It doesn’t address any object at all.

---

<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, 2002, 1:47pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/9 "2002-08-30T13:47:56Z")

</div>

yeah the problem is its looking for it in the root of ur movie…so the main scene not the one thats being loaded up so use \_parent cause its good…hehe

---

<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, 2002, 8:49pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/10 "2002-08-30T20:49:38Z")

</div>

> \*Originally posted by david \*  
> \*\*how can that work? It doesn’t address any object at all. \*\*

I dunno, I never tried it until MX and it always works for me. Just have to put it in the movie clip and you’re set.

---

<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 31, 2002, 1:10am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/11 "2002-08-31T01:10:29Z")

</div>

Case in point… a million ways in Flash.

You do not need a button inside an mc in Flash MX, and your code on your mc can be.

on(press){

this.startdrag();  
}

on(release){  
this.stopdrag();  
}

and \_root and \_parent won’t matter, at least not for dragging (\_root and/or \_parent will probably become indispensable as complexity grows).

---

<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 31, 2002, 10:21am UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/12 "2002-08-31T10:21:15Z")

</div>

Yeah flash mx is really good in that way…

---

<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 31, 2002, 4:37pm UTC](https://forum.kirupa.com/t/draggable-movieclip-wont-work/5036/13 "2002-08-31T16:37:53Z")

</div>

Nice… that’s really quite cool. It makes sense too… just not from a Flash5.0 standing… I guess the program is simply becoming more ‘intelligent’ as they progress through their versions.
