2 Replies Latest reply on Feb 16, 2011 2:32 AM by tripleA999

    Displaying time , according to time line

    tripleA999 Level 1

      Hello

       

      I have a time line of 1441 frames

      my frameRate is 24 fps

      so it takes 1 minute exactly to complete the timeline animation

       

      I want to Display the Remaining time as file starts

       

      I need formula to place in ENTER_FRAME event which displays the time left

       

      Thank you

        • 1. Re: Displaying time , according to time line
          moccamaximum Level 5

          this.addEventListener(Event.ENTER_FRAME, timeLeft);

           

          function timeLeft(e:Event):String{

          var framesLeft:uint =  this.totalframes-this.currentframe;

          var secondsLeft: uint= Math.floor(framesLeft/24);

          var minutesLeft: uin= Math.floor(secondsLeft/60);

          var secondString:String = String(secondsLeft%60);

          if (secondString.length==1){

          secondString = "0"+ secondString

          }

          var timeLeft:String = minutesLeft+":"secondString;

          return timeLeft;

          }

           

          PS: You are aware that that is as far from the correct time as it gets? Flash framerate hugely depends on the machine it runs.

          If you would want to measure the real time your animation actual plays you would use a Timer

          • 2. Re: Displaying time , according to time line
            tripleA999 Level 1

            yes I know frames rate depends on Machine

             

            i have checked that code about how frames rate behave in loading files