
Код:
MovieClip.prototype.slideTo = function(x, y, speed, onComplete) {
this.x = x;
this.controller = this.createEmptyMovieClip("controller", 1);
this.onComplete = onComplete;
this.controller.trg = this;
this.y = y;
this.speed = speed;
this.controller.onEnterFrame = function() {
this.trg._x += (this.trg.x-this.trg._x)/this.trg.speed;
this.trg._y += (this.trg.y-this.trg._y)/this.trg.speed;
if (Math.abs(this.trg._x-this.trg.x)<2 && Math.abs(this.trg._y-this.trg.y)<2) {
delete this.onEnterFrame;
this.trg._x = x;
this.trg._y = y;
this.trg.onComplete();
}
};
};
image.onEnterFrame = function() {
this.slideTo(_root._xmouse, this._y, 3);
};