Copy link to clipboard
Copied
Hello all,
I want to create a number counter using AS3 and a dynamic text box (myTextBox_txt). I want to be able to set the starting number (e.g. 15986) and have it increment quickly to another set number.
I've been out of scripting for a while and can't think how to do it!
Cheers
Nick
Copy link to clipboard
Copied
what causes the textfield to increment?
the passage of time? if so, use a timer.
user visits? if so, you'll need to use, at least, one server-side file.
Copy link to clipboard
Copied
it will be over time, what would be the coding to do this with a timer?
Copy link to clipboard
Copied
var t:Timer=new Timer(1000,0); // assumming you want to update about once per second (=1000 ms)
t.addEventListener(TimerEvent.TIMER,f);
t.start();
function f(e:TimerEvent):void{
tf.text=String(t.currentCount); // where tf is your textfield reference
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now