View Full Version : dragging? weird?
iceman
January 14th, 2004, 06:27 PM
Whenever I add a drag action to a movieclip and add constraints it doesn't work properly and the movieclip after its pressed jumps to the top of the screen.I was hoping someone could help me figure out why this happens. I'll Post my .fla
Thanks
Kyle:p:
norie
January 14th, 2004, 06:40 PM
startDrag(this, false,0,0,Stage.width, Stage.height)
elshawno
January 15th, 2004, 04:08 PM
hey man, thanks for posting that tid bit. i still can't seem to get it to work though. here's what my script looks like:
onPress = function () {
this.startDrag(this, false, 500, 375, Stage.width, Stage.height);
};
onRelease = function () {
this.stopDrag();
};
my symbol is a gif, that's a movie clip. any ideas on what's wrong with my scripting?
norie
January 15th, 2004, 05:29 PM
since only one instance of startDrag and StopDrag can be made at anyone time in a flash movie, there is no need to use variable scope or objects. so this should suffice.
onPress = function () {
startDrag(this, false, 500, 375, Stage.width, Stage.height);
};
onRelease = function () {
stopDrag();
};
also, on startDrag, if you MC isn't within the set boudries Flash will movie it there for you.
elshawno
January 15th, 2004, 05:50 PM
thanks!
it's working now, but i can't seem to figure out where my boundaries are. is there something i should know about how this is defined?
and what does the true/false specify? i'm assuming the 500, 375 bit should be my movie height/width, but that's moving it way outside my movie when i click on it.
hmm. any more ideas?
elshawno
January 15th, 2004, 06:13 PM
nevermind, i got it. :rock: i changed the onPress and onRelease to (press) and (release), just because a friend suggested that. to be honest i don't think that made a difference. but i looked up the properties of the startDrag element and learned better syntax:
on (press) {
startDrag(this, false, 450, 265, 75, 35);
}
on (release) {
stopDrag();
}
basically it says, startDrag, this item, don't use the cursor pointer grab point - just use the center point, then define how many pixels from the left, top, right, bottom our stage should be.
thanks again. hope this helps any other newbs (like myself).
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.