2 Replies Latest reply on May 1, 2006 2:19 PM by john.gooch

    Format Dynamic Text...

      I'm developing a media playback control set, and I need to run a dynamic text box with the "my_FLVplayback.playheadTime" property filling it.

      While I have achieved this, I now need to format it in normal "timecode" format (00:00:00). What is the best way to do this? (I'd like the colons and the normal sixty based time format--that is, going from 00:00:59 to 00:01:00)

      Thanks in advance!
        • 1. Re: Format Dynamic Text...
          blemmo Level 1
          playheadTime returns the seconds, right? So you will have to calculate the minutes and hours:
          var sminutes:String;
          var nminutes:Number = my_FLVplayback.playheadTime/60;
          if (nminutes < 10){
          sminutes = "0"+nminutes.toString();
          sminutes = nminutes.toString();

          You might add rounding, but basically this is the way to 'format' the time.

          • 2. Re: Format Dynamic Text...
            Isn't there a better way of doing this? Most languages ( Perl/C/C++/Python/etc ) have a text formatting language like this :
            "%02d ", variable

            Where the 02d specifies that it will print out a 2 digit number with leading 0' if there is only one digit, and there will not be a decimal number in the output. such as "01" . It seems strange for Actionscript not to have something that is pretty much standard across languages today.