Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Counter

New Here ,
Feb 06, 2014 Feb 06, 2014

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

TOPICS
ActionScript
350
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2014 Feb 06, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2014 Feb 06, 2014

it will be over time, what would be the coding to do this with a timer?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2014 Feb 06, 2014
LATEST

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines