You started doing it right - create a class for what you call Ball
. Then you can make public functions inside it in order to change it's properties:
function setSpeed(value:Number) {
this.speed = value; // what used to be Aspeed, Bspeed, Cspeed, now is simply 'speed'
}
function setColor(color:uint) {
this.graphics.beginFill(color); // used to be `0xFF0000`, now is dynamic
}
speed
is a member variable inside this class, and this.graphics
is used because the class should extend Sprite.
So you will instantiate the same class, but will simply 'skin' it using one line functions. You can even make a for loop in order to create balls easier.