How do I convert an integer to a string value? This must be easy. \"Ya guys in SO are da best at explaining.\" I\'m still working on these dumb counters.
COUNTER "DYNAMIC TEXT" with zero values solution
I'm posting on behalf of Ed, a human that helped me over the phone. It was a problem with the string arguments and the syntax in mytext.
//CA, NC, LONDON, ED "increments"
var timer:Timer = new Timer(10);
var count:int = 0; //start at -1 if you want the first decimal to be 0
var fcount:int = 0;
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count*count/10000);//starts out slow... then speeds up
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);
}