0 Replies Latest reply on Mar 20, 2008 6:34 AM by Nieckarz

    Pause sound duration

    Nieckarz

      Here it is my duration function, play funtion and pause funcion
      the problem is i can't find a way to stop the timer of the duration
      the text field is called t1.

      Thank you


      this.onEnterFrame = function() {
      t1 = int(sndObject.duration/1000/60);
      t1 = t1+" : "+int((sndObject.duration/1000-(t1*60)));
      sndObjectf = int((sndObject.duration-sndObject.position)/1000/60);
      elapsed_sec = int((((sndObject.duration-sndObject.position)/1000/60)-sndObjectf)*60);
      if (elapsed_sec<10) {
      elapsed_sec = "0"+elapsed_sec;
      }
      if (sndObjectf<10) {
      sndObjectf = "0"+sndObjectf;
      }
      if (_root.stpd) {
      elapsed = _root.t1;
      } else {
      elapsed = sndObjectf+" : "+elapsed_sec;}
      //mo=sndObject.position/1000
      //elapsed =
      vol = sndObject.getVolume()+" %";
      dur = sndObject.duration;
      pos = sndObject.position;
      per = (pos/dur)*100;
      m = (pos/dur)*100;
      bar._width = (m*xx)/100;
      drag._x = _root.bar._width+_root.bar._x;
      //drag._y = 136;
      if (stpd) {
      xx = 0;
      } else {
      xx = orginal_width;
      }}
      // function keys

      function playSong()
      {
      if (pausePos == 0)
      {
      sndObject.setVolume(songVolume);
      sndObject.loadSound(file, true);
      loadProgressInt = setInterval(loadProgress, 50);
      } // end if
      sndObject.start(pausePos);
      playProgressInt = setInterval(playProgress, 50);
      pauseBut._visible = true
      playBut._visible = false;
      gotoAndPlay("play");
      dur = sndObject.duration;
      } // End of the function



      function pauseSong(p)
      {
      if (!p)
      {
      pausePos = sndObject.position / 1000;
      }
      else
      {
      pausePos = p;

      } // end else if
      sndObject.stop();
      pauseBut._visible = false;
      playBut._visible = true;
      clearInterval(playProgressInt);
      gotoAndPlay("pause");
      } // End of the function