How can I set my countdown correctly?
I'm counting from 33,000.00 to zero. It works in a fashion, but the minus operator appears in the textfield.
//Countdown from 33,000.00 to zero
var timer:Timer = new Timer(10);
var count:int = -3300000;
var fcount:int = 0;
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count);
mytext.text = formatCount(fcount);
}
function formatCount(i:int):String {
var fraction:int = i % 100;
var whole:int = i / 100;
return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction);
}
EXAMPLE
I need something I can update with XML, to be an up-counter or down-counter depending on the variables.
//Count up from 33,000.00
var countValue:int = 3300000;
count = countValue;
//Count down from 33,000.00
var countValue:int = -3300000;
count = countValue;