Skip to main content
Participating Frequently
Mar 29, 2017 3:31 PM UTC
Answered

Creating a counter in HTML5

Hi all,

We're trying to create a simple counter in HTML5, but all I find online is AS3...

We need the numbers to go from 10.000 -> 50.000

Is it possible?

Thanks for your help!

    This topic is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    Mar 29, 2017 6:13 PM UTC

    Haha exactly

    Thank you for your help!


    var start = 10000;

    var end = 50000;

    var current = start;

    var f = tickerF.bind(this)

    createjs.Ticker.addEventListener('tick',f);

    function tickerF(){

    this.your_tf.text = current;

    current++;

    if(current>end){

    createjs.Ticker.removeEventListener('tick',f);

    }

    }

    22 replies

    kglad
    Community Expert
    Community Expert
    Mar 29, 2017 3:58 PM UTC

    you want something that you click (up or down) to increment or decrement a display?

    Translate
    Participating Frequently
    Mar 29, 2017 4:08 PM UTC

    No, just the running numbers automatically

    Translate
    kglad
    Community Expert
    Community Expert
    Mar 29, 2017 4:35 PM UTC

    what are "..running numbers.."?

    do you want something that displays numbers incrementing from 10,000 to 50,000 over some time period?

    Translate