I need to use a Timer for time controlled animation, time the drawing to occur every 500 milliseconds & Draw 20 circles in total. I also need to make sure the circles are completely drawn inside the limits of the stage.. I've been trying to figure this out forever and it's driving me crazy. This is the code I've been playing around with and I can't figure it out. PLEASE HELP ASAP!!!
import flash.events.TimerEvent; import flash.utils.Timer;
// creates a new hundred-second Timer, ticks every 250 milliseconds var faster_minuteTimer:Timer = new Timer(250, 6);
// designates listeners for the interval and completion events faster_minuteTimer.addEventListener(TimerEvent.TIMER, onTick); faster_minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
// starts the timer ticking faster_minuteTimer.start();
function onTick(event:TimerEvent):void { // displays the tick count so far trace("Count... " + event.target.currentCount); } function onTimerComplete(event:TimerEvent):void { trace("Play Done."); } var xCoord, yCoord, radius, Width, Height:uint; // declare variables
// not using any variables for the first one
xCoord = (Math.random()* stage.stageWidth); // somewhere on the stage yCoord = (Math.random() * stage.stageHeight); radius = Math.max(Math.random() * 85, 20); // radius between two numbers
graphics.beginFill(Math.random() * 0xffffff); // random color graphics.drawCircle(xCoord,yCoord,radius); // coordinates x & y, radius graphics.endFill(); // end color fill