Clip | Source
ActionScript
onClipEvent (load) {
var intStageSizeX = 300;
var intStageSizeY = 300;
var fltRandomX;
var fltRandomY;
this.onRollOver = function() {
do {
fltRandomX = Math.random()*(intStageSizeX-this._width)
+this._width/2;
fltRandomY = Math.random()*(intStageSizeY-this._height)
+this._height/2;
} while (Math.abs(fltRandomX-this._x) < 2*this._width ||
Math.abs(fltRandomY-this._y) < 2*this._height);
this.onEnterFrame = function() {
var fltDeltaX = (fltRandomX-this._x)/4;
var fltDeltaY = (fltRandomY-this._y)/4;
this._x = fltDeltaX+this._x;
this._y = fltDeltaY+this._y;
if (fltDeltaX < 1 && fltDeltaY <1) {
flagStill = true;
delete this.onEnterFrame;
}
};
};
}