Skip to main content
Participant
December 3, 2013
Answered

Hi i need help with my mp3 flash player

  • December 3, 2013
  • 1 reply
  • 441 views

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>

This topic has been closed for replies.
Correct answer kglad
:

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]);

};

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 3, 2013
:

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]);

};