4 Replies Latest reply on Jan 29, 2008 2:09 PM by Newsgroup_User

    getTimer() Reset? (k)

    Level 7
      Is there a way to reset getTimer?

      Here is the ActionScript I am using in a LOOPING file:

      totalTime = 0;
      //Start from 0 minute
      startTime = getTimer();
      function timer() {
      timeLeft = (totalTime*1000)+(getTimer()+startTime);
      minutes = Math.floor(0);
      seconds = Math.floor(timeLeft/1000);
      milliseconds = Math.floor((timeLeft-(seconds*1000))/10);
      millisOut = milliseconds;
      secondsOut = seconds;
      minsOut = minutes;
      if (seconds>59) {
      secondsOut = seconds-60;
      minsOut = minutes+1;
      }
      if (minsOut<10) {
      minsOut = String("0"+minsOut);
      }
      if (millisOut<10) {
      millisOut = String("0"+millisOut);
      }
      if (secondsOut<10) {
      secondsOut = String("0"+secondsOut);
      }
      _level0.timerOut.text = "00:"+minsOut+":"+secondsOut+":"+millisOut;
      }
      timer1 = setInterval(timer, 10);


      It is connected to a dynamic text box to simulate a stopwatch counting off.

      It works great except when I go to loop it. Since getTimer is the
      seconds the SWF has been playing, it keeps going even after everything
      else has gone back to the first frame.

      -Kirk