hey guys,
I’ve designed an audio interface that plays streamed audio files that I have saved as mp3’s on my server. It works great but, when the first song ends, it plays the second song etc. I want it to loop the current song unless the user requests otherwise. What should I add to the following script?
thanks very much,
artane
…
_global.songs = new Array();
_global.playing = “no”;
_global.currentSong = 1;
_global.songs[1] = “song1.mp3”; //the mp3 file uploaded into the same directory in the ftp as the swf file
_global.songs[2] = “song2.mp3”;
_global.songs[3] = “song3.mp3”;
_global.playSong = function(){
if(_global.playing != “yes”){
_global.stopSong();
_global.songObject = new Sound();
trace(_global.songs[_global.currentSong]);
_global.songObject.loadSound(_global.songs[_global.currentSong],true);
_global.songObject.onSoundComplete = function(){
_global.nextSong();
_global.playSong();
}
_global.playing = “yes”;
}
};
_global.stopSong = function(){
_global.songObject.stop();
_global.playing = “no”;
};
_global.nextSong = function(){
numSongs = _global.songs.length;
numSongs -= 1;
if(_global.currentSong < numSongs){
_global.currentSong += 1;
}else{
_global.currentSong = 1;
}
if(_global.playing == “yes”){
_global.stopSong();
_global.playSong();
}
trace(_global.currentSong);
};
_global.prevSong = function(){
numSongs = _global.songs.length;
numSongs -= 1;
if(_global.currentSong > 1){
_global.currentSong -= 1;
}else{
_global.currentSong = numSongs;
}
if(_global.playing == “yes”){
_global.stopSong();
_global.playSong();
}
};
_global.volumeUp = function(){
vol = _global.songObject.getVolume();
if(vol < 100){
volume_txt.text = vol;
vol += 5;
_global.songObject.setVolume(vol);
}
};
_global.volumeDown = function(){
vol = _global.songObject.getVolume();
if(vol > 0){
volume_txt.text = vol;
vol -= 5;
_global.songObject.setVolume(vol);
}
};
_global.playSong();