1 Reply Latest reply on Feb 18, 2010 7:19 AM by kglad

    length of sound

    mrbooombastic

      Hi, I'm trying to write a simple mp3 player in Flash. I'm almost finished, but I'm stuck on getting the length(duration) of the current track.

      Heres what I'm doing inside my "play" button:

       

      on(press){
           
           function callback1() {
      trace("mySound completed");
      i++;
      output_txt=my_lv2["out"+i];
      my_lv["parent"].my_sound.loadSound(my_lv["var"+i],true);
           }
      my_sound.onSoundComplete = callback1;
      
      
      var my_sound:Sound = new Sound();
      var my_lv:LoadVars = new LoadVars();
      my_lv["parent"] = this;
      my_lv.onLoad = function(success:Boolean) {
      if (success) {
           
      my_lv["parent"].my_sound.loadSound(my_lv["var"+i],true);
      my_sound.onSoundComplete = callback1;
      } else {
      trace("Error loading/parsing LoadVars.");
      }
      };
      my_lv.load("playText.txt");
           
      var my_lv2:LoadVars = new LoadVars();
      my_lv2["parent"] = this;
      my_lv2.onLoad = function(success:Boolean) {
      if (success) {
      output_txt=my_lv2["out"+i];
      } else {
      trace("Error loading/parsing LoadVars.");
      }
      };
      my_lv2.load("outputFile.txt"); 
           
      }
      
      

      Can anyone pls help me complete this code?

      Regards

      Aubrey.