1 Reply Latest reply on Aug 12, 2006 7:34 AM by kglad

    explanation for countdwn timer

    m2ming
      hi, can anyone help to explain this script, line by line, as in what does " var", "secInd", stands for, when to use it, how to use it etc...

      stop();
      var timerID:Number;
      var secInd:Number =0;
      var maxTime:Number = 60;

      startTimer();

      function updateTimer(){
      secInd = maxTime--;

      timer_txt.text = String(secInd);

      if (secInd == 0){
      trace("game over");
      stopTimer();
      trace("this = " + this);
      gotoAndPlay("gameOver");
      }
      }
      function startTimer():Void{
      timer_txt.text = String(maxTime);
      timerID = setInterval(this, "updateTimer", 1000);
      }
      function stopTimer():Void{
      clearInterval(timerID);
      }