PDA

View Full Version : [MX] Another easing question....



Keith130
July 2nd, 2003, 05:26 PM
Hi I have this MC and I need it to move, so surprises there. I have this on the MC onClipEvent(load){
musicNormalX = _x;
musicNormalY = _y;
musicTargetX = _x;
musicTargetY = _y;
easeSpeed = 1000;
}
onClipEvent(enterFrame){
this._x += (musicNormalX - musicTargetX)/easeSpeed;
this._y += (musicNormalY - musicTargetY)/easeSpeed;
}

And then this on a button :

on(release){
_root.music.musicTargetX = 10;
_root.music.musicTargetY = 10;
}

The MC ID is music as you could tell from the button code. What happens is that the MC moves. But then it doesn't stop!!! Well I am puzzled out of ideas.

Keith130
July 2nd, 2003, 05:38 PM
Doesnt matter I fixed if by using onClipEvent(load){
musicTargetX = _x;
musicTargetY = _y;
easeSpeed = 1000;
}
onClipEvent(enterFrame){
this._x += (musicNormalX - _x)/easeSpeed;
this._y += (musicNormalY - _y)/easeSpeed;
}

Its was using a fixed var before but now it uses the current _x and _y to calculate the next position.