This Actionscript has been added to a basic movie clip -- the script was created so the MC will avoid the mouse. It works great when I publish in Player 6, but not 8. Please help. Thanks in advance.
Code:
onClipEvent(load){
homeX = this._x;
homeY = this._y;
magnet = 1000;
}
onClipEvent(enterFrame){
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 = this._x - (distancex / distance) * magnet / distance;
powery = this._y - (distancey / distance) * magnet / distance;
forcex = (forcex + (homex - x0) / 2) / 1.66;
forcey = (forcey + (homey - y0) / 2) / 1.66;
this._x = powerx + forcex;
this._y = powery + forcey;
}