i have been asked to make a countdown from 5 to 0 within 10seconds using flash and i have no idea where 2 start can somone help me with the code
thank you
Welcome aboard, give this a try:
//Create TextField
var timeText:TextField = this.createTextField("timeText", this.getNextHighestDepth(), 100, 100, 100, 100);
//Set intial time
timeText.text = "5";
//Set variable to time
var timeNum:Number = 5;
//Create interval at 2 seconds (2*5=10 seconds)
var timeInc:Number = setInterval(incTimer, 2000);
//Call function on interval
function incTimer():Void {
//If number is greater then 0 - drop the number by one, else - clear the interval
(timeNum>0) ? timeNum-- : clearInterval(timeInc);
//Send the new number to the textfield
timeText.text = String(timeNum);
}
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.