How do I use the counter to trigger sprites? Need an example or idea to work from.
I want the number values to load sprites. The value of the counter goes to a text field. I want each number value to have an "if" condition to play a sprite of a corresponding number.
Dumb example
//counter plays pictures rather than plays numbers in text field
Verbose example
//if more than 0 and less than 2, play 1 ==> ONE DISPLAYS ON SCREEN
Comparison
-variable data display "like Flash music visualization"
-data is a counter instead
How it could work
-loaders receive number values from counter
-9 targets "9 number spaces"
-add and remove child
-allows counter to look like anything
COUNTER I WANT TO USE
//"counts to a million with two decimal places" <br>
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);
}