PDA

View Full Version : smooth motion


trapz
02-15-2009, 04:08 PM
How to add smooth motion to "the reset button"?
Sorry, maybe simple, but i am a newbie:confused:
Any ideas appreciated!!






function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;

} else {
this.onTarget = false;

}
};

clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
clip.onEnterFrame = function() {

if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;

}
};
}

dragSetup(pin1,targetRect1);


//reset button
reset.onRelease = function(){
// send dragger to start point
pin1._x = pin1.myHomeX;
pin1._y = pin1.myHomeY;