forked from: flash on 2010-4-14
/**
* Copyright koshitarou ( http://wonderfl.net/user/koshitarou )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7sXs
*/
// forked from kihon's flash on 2010-4-14
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
public class Main extends Sprite
{
private var balls:Vector.<Ball> = new Vector.<Ball>();
private var frame:int = 0;
public function Main()
{
transform.perspectiveProjection.projectionCenter = new Point(0, 0);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
if (frame++ % 10 == 0)
{
var ball:Ball = new Ball();
ball.x = Math.random() * 465;
ball.y = Math.random() * 465;
addChild(ball);
balls.push(ball);
}
for (var i:int = 0; i < balls.length; i++)
{
balls[i].z += 10;
if (balls[i].z >= 3000)
{
removeChild(balls[i]);
balls.splice(i--, 1);
}
}
}
}
}
import flash.display.Sprite;
class Ball extends Sprite
{
public function Ball()
{
graphics.beginFill(0x0);
graphics.drawCircle(0, 0, 10);
graphics.endFill();
}
}