View Full Version : Draggable movieclip won't work
Aikido
August 29th, 2002, 11:17 AM
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?
luksy
August 29th, 2002, 11:32 AM
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.
Aikido
August 29th, 2002, 12:19 PM
yes, it's a button. and that's the code. but for some reason it doesn't work.
wirebrain
August 30th, 2002, 05:36 AM
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.
Kitiara
August 30th, 2002, 05:43 AM
Buddy, that's <I>bad</I>. :)
But I'd agree. Take out the full name, just use nothing. Or 'this' at a push.
upuaut
August 30th, 2002, 07:03 AM
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.
wirebrain
August 30th, 2002, 07:53 AM
I would just use
on(press)
{
startDrag("", false);
}
always works for me.
upuaut
August 30th, 2002, 08:22 AM
how can that work? It doesn't address any object at all.
Bezzer
August 30th, 2002, 09:47 AM
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
wirebrain
August 30th, 2002, 04:49 PM
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.
Iammontoya
August 30th, 2002, 09:10 PM
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).
Bezzer
August 31st, 2002, 06:21 AM
Yeah flash mx is really good in that way.....
upuaut
August 31st, 2002, 12:37 PM
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.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.