View Full Version : Smooth Drag
darastudio
06-28-2007, 04:24 PM
i just want to know how to move a movieclip around with the mouse
much like this: http://jdk.com/live/onExhibit.php?onExhibit=1
not ness. to be fullscreen flash.
I'm also using lmctween for the button part of it... I just want the functionality of grabbing it and dragging it... also maybe clicking individual images with URLs.
mcmcom
06-28-2007, 04:44 PM
read this : http://www.kirupa.com/developer/actionscript/dragdrop.htm
hth,
mcm
darastudio
06-28-2007, 04:51 PM
i've already seen this... and searched a lot of the web.
definitely not what i'm looking for.
this is along x axis only and has easing. as well as left and right boundaries... also the items in the movieclip need to be clickable.
mcmcom
06-28-2007, 06:13 PM
what you want can probably be achieved by a scrollpane that auto scrolls when the mouse reaches either teh left or the right side of the pane (and you could add also when the button is pressed). I know GhostWireComponents has a scroll pane that does this. however you have to pay like $30 for it.
I have also seen posts about something called the "smooth scroller" component, although i have never used it, it may help you out.
hth,
mcm
gankro
06-28-2007, 06:20 PM
well for smoothness you can max out the frame rate i think the limit is 99fps or something...
darastudio
06-28-2007, 06:27 PM
well for smoothness you can max out the frame rate i think the limit is 99fps or something...
look at the link in my initial post... i want the smoothness of grabbing it and sliding it... if you click and drag and let go... it keeps going a little, it just doesn't stop abruptly.
i've found somehting very similar in AS 1.0 but i need it to work in 2.0.
i have this on my main movie clip.
onClipEvent (load) {
xfinal = _x;
}
onClipEvent (enterFrame) {
if (drag) {
x = _root._xmouse+xd;
} else {
x = xfinal+xd;
}
if (x >= 400){
x = 0;
}
if (x <= -370){
x = -221.1;
}
but1.onRelease = function() {
x = -221.1;
}
//change value here to change speed
_x += (x-_x)/20;
}
and this on my individual clips inside the main movieclip.
bb1.onPress = function() {
drag = true;
xd = _x-_root._xmouse;
xstart = _root._xmouse;
}
bb1.onRelease = function() {
drag = false;
xfinal = _root._xmouse;
if (xstart == xfinal){
getURL("http://www.apple.com");
}
}
darastudio
06-28-2007, 07:02 PM
i also found this... which is somewhat working... but i can't click objects within the movieclip yet. also... the higher the easing... the more the movieclip wants to shift back to the left. (anchor point is on the top left of the mc).
myMC.ease = 2;
myMC.targX = myMC._x;
myMC.targY = myMC._y;
myMC.onPress = function() {
ptX = this._x-_xmouse;
ptY = this._y-_ymouse;
this.drag = true;
};
myMC.onEnterFrame = function() {
if (this.drag) {
this.targX = _xmouse+ptX;
this.targY = _ymouse+ptY;
}
if (this._x != this.targX | this._y != this.targY) {
this._x += (this.targX-this._x)/this.ease;
this._y += (this.targY-this._y)/this.ease;
}
};
myMC.onMouseUp = function() {
this.drag = false;
};
myMC2.onPress = function() {
delete this.onEnterFrame;
this.startDrag(false);
};
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.