This is a counter. I'm making a spread sheet and getting nowhere. How do I measure these variables?
V A R I A B L E S
- timer = speed
- count = starting number and direction “+-“
- fcount = time ramp “fast or slow”
MY THOUGHTS
- make an equation or spread sheet
- use a frame counter, but it's not frame based
CODE
Define an instance of "mytext" in dynamic text.
Paste the actionscript-3 in the editor, and run it.
//Counter as3
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/1000);//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);
}