
Код:
MovieClip.prototype.move = function() {
this.onLoad = function() {
defaultX = _x;
defaultY = _y;
magnet = 500;
};
this.onEnterFrame = function() {
X0 = this._x;
y0 = this._y;
X1 = _root._xmouse;
Y1 = _root._ymouse;
distanceX = X1-X0;
distanceY = Y1-Y0;
distance = Math.sqrt(distanceX*distanceX+distanceY*distanceY);
powerX = _x-distanceX/distance*magnet/distance;
powerY = _y-distanceY/distance*magnet/distance;
forceX = (forceX+(defaultX-X0)/2)/1.660000;
forceY = (forceY+(defaultY-Y0)/2)/1.660000;
_x = powerX+forceX;
_y = powerY+forceY;
};
};
для одного подходит, а для много ???