flash on 2011-2-28
/**
* Copyright shapevent ( http://wonderfl.net/user/shapevent )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/SqfQ
*/
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class FlashTest extends Sprite {
public function FlashTest() {
addChild(new Ball(100, 100));
addChild(new Ball(200, 200));
addChild(new Ball(300, 300));
var txt:TextField = new TextField();
txt.text = String(Ball.length);
addChild(txt);
}
}
}
import flash.display.*;
class Ball extends Sprite{
private static var balls:Array = [];
public static function get length():int{
return Ball.balls.length;
}
public function Ball(x:Number, y:Number){
create(x, y);
balls.push(this);
}
private function create(x:Number, y:Number):void{
graphics.beginFill(0);
graphics.drawCircle(x, y, 10);
}
private function collision():void{
var allBalls:Array = Ball.balls;
for (var i:int = 0; i<allBalls.length; i++){
}
}
}