Код:
this.createEmptyMovieClip ("mc", 0);
mc.lineStyle (0);
mc.moveTo (-50, -50);
mc.lineTo (50, -50);
mc.lineTo (50, 50);
mc.lineTo (-50, 50);
mc.lineTo (-50, -50);
mc._x = mc._y = 200;
this.dist = function () {
return Math.sqrt (Math.pow (this._xmouse - this.mc._x, 2) + Math.pow (this._ymouse - this.mc._y, 2));
};
this.move = function () {
var r = this.dist ();
if (r < 100) {
trace (r);
var dr = (100 - r) / 2;
var u = Math.atan2 (this._ymouse - this.mc._y, this._xmouse - this.mc._x);
this.mc._x -= dr * Math.cos (u);
this.mc._y -= dr * Math.sin (u);
} else {
delete this.onEnterFrame;
}
};
this.onMouseMove = function () {
if (this.dist () < 100) {
this.onEnterFrame = this.move;
}
};