TimerTest
/**
* Copyright nekey ( http://wonderfl.net/user/nekey )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ex1H
*/
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class myTimer extends Sprite {
public function myTimer () {
var test_timer:Timer = new Timer ( 200 );
test_timer.addEventListener( TimerEvent.TIMER, testTimer );
test_timer.start();
}
public function testTimer ( e:TimerEvent ):void {
drawcircle();
}
public function drawcircle ():void {
var myCircle:Sprite = new Sprite ();
var myRandomX:Number = Math.floor( Math.random() * 550 );
var myRandomY:Number = Math.floor( Math.random() * 400 );
var myRandomR:Number = Math.floor( Math.random() * 40 );
myCircle.graphics.beginFill(0x34e1a6);
myCircle.graphics.drawCircle( 0,0,myRandomR );
myCircle.graphics.endFill();
myCircle.x = myRandomX;
myCircle.y = myRandomY;
addChild( myCircle );
}
}
}