class AntClass extends MovieClip { var v:Number; public function init() { this._x=random(640); this._y=random(480); this._rotation=random(360); this.onRollOver = function() { this._alpha = 50 } this.v = 3.0; this.onEnterFrame = this.moveAroundium; } public function moveAroundium() { var vx = this.v*Math.cos(Math.PI / 180 * this._rotation); var vy = this.v*Math.sin(Math.PI / 180 * this._rotation); this._x+=vx; this._y+=vy; // bound check if (this._x<0) { this._x=640; } else if (this._x>640) { this._x=0; } if (this._y<0) { this._y=480; } else if (this._y>480) { this._y=0; } // randomly change direction of travel this._rotation+=15*(Math.random()-Math.random()); } }