class Ball extends MovieClip { private var vx, vy; public function Ball( ) { stop(); } public function move( ) { this._x += vx; this._y += vy; if ( this._x >= Stage.width-(this._width/2) || this._x < this._width/2 ) vx *= -1; if ( this._y >= Stage.height-(this._height/2) || this._y < this._height/2 ) vy *= -1; } public function kill() { play(); } public function startSpeed( speed ) { vx = Math.random()*4 -2; vy = Math.random()*-3 - ( speed/20); } }