# Game Timer Problems

**URL:** <https://forum.kirupa.com/t/game-timer-problems/254948>\
**Category:** flash\
**Created:** [March 17, 2008, 5:12pm UTC](https://forum.kirupa.com/t/game-timer-problems/254948 "2008-03-17T17:12:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![copenhagen](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@copenhagen](https://forum.kirupa.com/u/copenhagen)\
**Post date:** [March 17, 2008, 5:12pm UTC](https://forum.kirupa.com/t/game-timer-problems/254948/1 "2008-03-17T17:12:04Z")

</div>

Hi

I am doing this game in flash 8 proffesionel, but my timer creates a lot of problems. I have been looking everywhere for help, but without any luck.

First I placed a dynamic textfield at frame 1 on the main timeline stage called: mySeconds in the var field.  
and placed the value 0 in the textfield on the stage.

Then I wrote this code by opening the actionscript panel at frame 1 on the main timeline:

stop();  
function wait() {  
mySeconds++;  
if (mySeconds == 90) {  
gotoAndStop(70);  
}  
}  
myTimer = setInterval(wait, 1000);

Then I place a keyframe on frame 10, 20, 30, 40 50, 60 and 70 where the player is taken to each of these keyframes during the game.

I want the timer to stop on frame 40, 50, 60 and 70 so I put this code on frame 40, 50, 60 and 70:

onEnterFrame = function(stoppo) {  
clearInterval(myTimer);  
myTimer = setInterval(wait, 1000);  
}

the above code stops the timer, so until now the timer works great, BUT when I then write: gotoAndStop(1) after the code on frame 40, 50, 60 and 70  
so the movie begin playing frame 1 again, then my timer goes crazy.

Does anybody know how to make a timer who will work in my kind of game?
