
Код:
a.onEnterFrame = function () {
var dx = this._x - this._parent._xmouse;
var dy = this._y - this._parent._ymouse;
var angle = Math.atan2 (dy, dx);
if (Math.abs (dy) < 5 && Math.abs (dx) < 5) {
this._x = this._parent._xmouse;
this._y = this._parent._ymouse;
} else {
this._x -= Math.cos (angle) * 5;
this._y -= Math.sin (angle) * 5;
}
};