4 Replies Latest reply on Aug 10, 2009 7:42 AM by rlinsurf1

    MP3 timer

    rlinsurf1 Level 1

      I have the following code.

       

      I am loading a remote .mp3 file, and it's playing, but I assume it isn't fully loaded when it starts to play (i.e., streaming). As I already know the duration of the track, I'm adding that from an .xml. Then I'm testing for how long the .mp3 has been playing.

       

      playedseconds=Math.floor(this.sound.position/1000);
      playedtime=Math.floor(playedseconds/60) + ":" + playedseconds%60;
      trace(playedtime);
      

      and add a setInterval

       

      setInterval(doTheTimer,100);

      But the trace just reports

       

      NaN:NaN

      NaN:NaN

      NaN:NaN

      ...

       

      What am I doing wrong?