Associ al movieclip:
codice:
onClipEvent(load){
// t: current time, b: beginning value, c: change in value, d: duration
Math.linearTween = function (t, b, c, d){return c*t/d + b;};
this.movex = this.movey = 0;
this.duration = this.time = 20;
}
onClipEvent(enterFrame){
if(this.time > this.duration)return
this._x = Math.linearTween(this.time, this.beginx, this.movex, this.duration)
this._y = Math.linearTween(this.time, this.beginy, this.movey, this.duration)
this.time++
}
onClipEvent(mouseDown){
this.movex = _root._xmouse - (this.beginx = this._x);
this.movey = _root._ymouse - (this.beginy = this._y);
this.time = 0;
}