3 Replies Latest reply on Dec 18, 2006 10:20 AM by Bob_Robertson

    Countdown Script

    Acendo
      I followed Oman3D's Tutorial on a Countdown Script but I can't seem to find anything different.

      this.onEnterFrame = function() {

      var today:Date = new Date();
      var currentYear = today.getFullYear();
      var currentTime = today.getTime();

      var targetDate:Date = new Date(currentYear,11,25);
      var targetTime = targetDate.getTime();

      var timeLeft = targetTime - currentTime;

      var sec = Math.floor(timeLeft/1000);
      var min = Math.floor(sec/60);
      var hrs = Math.floor(min/60);
      var days = Math.floor(hrs/24);
      sec = string(sec % 60);
      if (sec.length < 2) {
      sec = "0" + sec;
      }
      min = string(min % 60);
      if (min.length < 2) {
      min = "0" + min;
      }
      hrs = string(hrs % 24);
      if (hrs.length < 2) {
      hrs = "0" + hrs;
      }
      days = string(days);

      var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
      time_txt.text = counter;

      }

      This pops-up:

      **Error** Scene=Scene 1, layer=actions, frame=1:Line 1: Syntax error.
      this.onEnterFrame = funtion() {

      Total ActionScript Errors: 1 Reported Errors: 1