-
[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(updateTimer, 1000);
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
but its not working... any ideas?
thanks
-
Prid - Outing
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
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|