Ball类代码:
package {
import flash.display.Sprite;
import flash.display.Graphics;
public class Ball extends Sprite {
public var radius:Number;
private var color:uint;
private var _vx:Number = 0;
private var _vy:Number = 0;
public function Ball(radius:Number=40,color:uint=0xff0000):void {
this.radius=radius;
this.color=color;
init();
}
private function init():void {
graphics.beginFill(color);
graphics.drawCircle(0,0,radius);
graphics.endFill();
}
public function get vx():Number
{
return _vx;
}
public function set vx(_vx1:Number):void
{
_vx = _vx1;
}
public function get vy():Number
{
return _vy;
}
public function set vy(_vy1:Number):void
{
_vy = _vy1;
}
}
}