Skip to main content
Participant
March 29, 2008
Answered

Sound won't loop

  • March 29, 2008
  • 1 reply
  • 171 views
Basically I want a music clip to loop in the background. I got it to load and play, but it won't loop. I've tried a few ways including;

song = new Sound();
song.loadSound("song.mp3", true);
song.play(0, 1);
song.onSoundComplete=function(){
song.play(0,1);
};

and

var song = new Sound();
song.onLoad = function() {
song.start(0,9999);
};
song.loadSound("song.mp3", true);

But it never wants to repeat. I know that there's no 'silence' in the sound so it has to be something in the script. Any help?
This topic has been closed for replies.
Correct answer
AFAIK, a streaming sound doesn't dispatch the onSoundComplete event. Instead, you could try loading the sound first before playing it. Something like:

song = new Sound();
song.onLoad = song.onSoundComplete = function(){
this.start(0, 1);
}
song.loadSound("song.mp3", false);

1 reply

Correct answer
March 31, 2008
AFAIK, a streaming sound doesn't dispatch the onSoundComplete event. Instead, you could try loading the sound first before playing it. Something like:

song = new Sound();
song.onLoad = song.onSoundComplete = function(){
this.start(0, 1);
}
song.loadSound("song.mp3", false);