flash on 2010-2-14
/**
* Copyright Tamanegi_kenshi ( http://wonderfl.net/user/Tamanegi_kenshi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qqmq
*/
package{
import flash.accessibility.Accessibility;
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
public class test extends Sprite{
private var sprite:Sprite;
private var X:Number =Math.random()*30;
private var Y:Number =Math.random()*300;
public function test(){
for(var i:int=0;i<10;i++){
init();
}
}
private function init():void{
sprite = new Sprite();
var fillColor:uint = 0xFFFFFF * Math.random();
sprite.graphics.beginFill(fillColor);
sprite.graphics.drawRect(0,0,20,20);
sprite.graphics.endFill();
sprite.x =Math.random()*30;
sprite.y =Math.random()*300;
stage.addChild(sprite);
sprite.addEventListener(Event.ENTER_FRAME,on);
}
private function on(event:Event):void{
event.target.y +=5;
event.target.x +=Math.random();
if(event.target.x>200){
stage.removeChild(event.target as Sprite);
init();
}
}
}
}