Hello,
I have just a play and pause button on a website I’m creating for a client that streams one mp3 song. It works great with the code below, but the problem is that when it reaches the end, it doesn’t loop back to the beginning. I would like for the user to be able to press the play button at the end to hear the song again, or include another button that rewinds back to the beginning. I’m sure it’s really simple code I need to add, but I have no idea what it is!
Thanks so much!
this.createEmptyMovieClip("sound_mc", 10);
music = new Sound(sound_mc);
music.loadSound("http://www.jcazmusic.com/audio/Sky.mp3", true);
music.start();
active_button = "play";
// pause button
pause_button_mc.onRelease = function() {
if (active_button == "play") {
pause_resume = music.position;
music.stop();
active_button = "pause";
}
}
pause_button_mc.onRollOver = function() {
this._alpha = 50;
}
pause_button_mc.onRollOut = function() {
this._alpha = 100;
}
// play button
play_button_mc.onRelease = function() {
if (active_button == "pause") {
music.start(pause_resume / 1000);
active_button = "play";
}
}
play_button_mc.onRollOver = function() {
this._alpha = 50;
}
play_button_mc.onRollOut = function() {
this._alpha = 100;
}