
Код:
pic.onMouseMove = function () {
this.speed = 0.1;
this.onEnterFrame = function () {
var dx = this._x - this._parent._xmouse;
var dy = this._y - this._parent._ymouse;
this._x += dx * this.speed;
this._y += dy * this.speed;
if (!(Math.abs (dx) > 0.01 && Math.abs (dy) > 0.01)) {
this._x = this._parent._xmouse;
this._y = this._parent._ymouse;
delete this.onEnterFrame;
}
if (pic._x < 0 || pic._y < 0 || pic._x > Stage.height || pic._y > Stage.width)
{
pic._x = Stage.width/2;
pic._y = Stage.height/2;
}
};
};