Draggable movieclip won't work

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?

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.

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

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.

Buddy, that’s <I>bad</I>. :slight_smile:

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

What no one likes “_parent”?? :slight_smile:

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.

I would just use

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

always works for me.

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

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

*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.

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).

Yeah flash mx is really good in that way…

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.