1 Reply Latest reply on Dec 3, 2013 7:20 PM by kglad

    Hi i need help with my mp3 flash player

    danmir1505

      Hi i need help with my mp3 player, i wan't to add pause button..can you help me?

       

      i created button i added btn_pause and it won't work.

       

      function soundStatus(){

                var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded() / _root.sound_mc.sound_obj.getBytesTotal();

                _root.loader.loadBar._width = amountLoaded * 260;

                duration = _root.sound_mc.sound_obj.duration;

                position = _root.sound_mc.sound_obj.position;

                _root.playHead._x = position / duration * 272 + 5;

      }

       

       

      btn_play.onRelease = function() {

                clearInterval(timeInterval);

                _root.timeDisplay_txt.text = "00:00/00:00";

                this._parent.sound_mc.songStarter(songfile[song_nr]);

      };

       

       

      btn_pause.onRelease = function() {

                clearInterval(timeInterval);

                _root.timeDisplay_txt.text = "00:00/00:00";

                this._parent.sound_mc.sound_obj.pause();

       

       

      };

      btn_stop.onRelease = function() {

                clearInterval(timeInterval);

                _root.timeDisplay_txt.text = "00:00/00:00";

                this._parent.sound_mc.sound_obj.stop();

      };

      btn_fw.onRelease = function() {

                clearInterval(timeInterval);

                _root.timeDisplay_txt.text = "00:00/00:00";

                (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;

                _root.sound_mc.songStarter(songfile[song_nr]);

      };

      btn_rev.onRelease = function() {

                clearInterval(timeInterval);

                _root.timeDisplay_txt.text = "00:00/00:00";

                (song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;

                _root.sound_mc.songStarter(songfile[song_nr]);

      };

       

      <moved by mod from as3 - kglad>

        • 1. Re: Hi i need help with my mp3 flash player
          kglad Adobe Community Professional & MVP
          :

           

          function soundStatus(){

                    var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded() / _root.sound_mc.sound_obj.getBytesTotal();

                    _root.loader.loadBar._width = amountLoaded * 260;

                    duration = _root.sound_mc.sound_obj.duration;

                    position = _root.sound_mc.sound_obj.position;

                    _root.playHead._x = position / duration * 272 + 5;

          }

           

           

          btn_play.onRelease = function() {

                    clearInterval(timeInterval);

                    _root.timeDisplay_txt.text = "00:00/00:00";

                    this._parent.sound_mc.songStarter(songfile[song_nr]);

          };

           

           

          btn_pause.onRelease = function() {

                    clearInterval(timeInterval);  // you should re-set this interval when the unpause button is clicked

                   // _root.timeDisplay_txt.text = "00:00/00:00";

                    this._parent.sound_mc.sound_obj.stop()

           

           

          };

          btn_unpause.onRelease=function(){

          this._parent.sound_mc.sound_obj.start(position/1000);

          }

          btn_stop.onRelease = function() {

                    clearInterval(timeInterval);

                    _root.timeDisplay_txt.text = "00:00/00:00";

                    this._parent.sound_mc.sound_obj.stop();

          };

          btn_fw.onRelease = function() {

                    clearInterval(timeInterval);

                    _root.timeDisplay_txt.text = "00:00/00:00";

                    (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;

                    _root.sound_mc.songStarter(songfile[song_nr]);

          };

          btn_rev.onRelease = function() {

                    clearInterval(timeInterval);

                    _root.timeDisplay_txt.text = "00:00/00:00";

                    (song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;

                    _root.sound_mc.songStarter(songfile[song_nr]);

          };