0 Replies Latest reply on Apr 3, 2007 1:56 PM by abcMe

    Changing TimeCounter to Numbers to display

    abcMe
      here is my code: I need to then change it to be numbers so I can display it reading with the coma for the millions. Like 1,234,000 right now if I place the , to read after say the min it places it in two spot so I need for all of this to be transfered into a number format instead of date. So that when our count reaches in the millions there will be a coma between the numbers. PLEASE HELP!! THANK YOU!!! Code below.

      this.onEnterFrame = function() {


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

      var targetDate:Date = new Date(2007,2,31);
      var targetTime = targetDate.getTime();

      var timeLeft = currentTime - targetTime;

      var sec = Math.floor(timeLeft/3000);
      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 < 3) {
      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;
      }