A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] timer

  1. #1
    Senior Member
    Join Date
    Mar 2006
    Posts
    139

    resolved [RESOLVED] timer

    hello,
    i'm using:

    PHP Code:
    ////////////////// TIMER //////////////////

    var timeStart 0
    var 
    timer timeStart;
    function 
    updateTimer() {
        if (
    timer>=0) {
            
    timer timer+1;       
        } else {
            
    gotoAndStop (2); 
            
    clearInterval(myInterval);
            
    delete myInterval;
        }
    }
    myInterval setInterval(updateTimer1000); 
    to display the amount of time spent playing a game.
    i'd like to append the word "seconds" after the time.
    i thought i could just add

    PHP Code:
    +("seconds"
    but its not working... any ideas?

    thanks

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    is timer the variable name of a Text Field? If so, then, instead of adding the timer directly to the text field var, store it in another variable and then display the timer along with "seconds" in your textfield. Because, if you add "seconds" directly to when incrementing your timer variable for the text field, it loses its mathematical function, thus not incrementing at all, but being interpreted as a string.

    Actionscript Code:
    var timeStart = 0;
    var myTimer = timeStart;
    function updateTimer() {
        if (myTimer>=0) {
            myTimer = myTimer+1;
            timer = myTimer+" seconds";
        } else {
            gotoAndStop (2);
            clearInterval(myInterval);
            delete myInterval;
        }
    }
    myInterval = setInterval(updateTimer, 1000);
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Senior Member
    Join Date
    Mar 2006
    Posts
    139
    thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center