artane
September 22, 2003, 10:55pm
1
Hey guys,
I want to make an entire song play as background music on my site. The mp3 is about 4 mb. I figure the only way to do this would be to stream the music off of the server. How can I do this and make it loop forever?
Thank-you very much,
artane
system
February 12, 2004, 6:47pm
2
hey kode,
I’m trying to apply your suggestion to the following script but, I can’t make it work. How can I loop the song that is currently playing until the user presses stop?
Thanks very much,
artane
_global.songs = new Array();
_global.playing = "no";
_global.currentSong = 1;
_global.songs[1] = "song1.mp3";
_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();
system
February 12, 2004, 6:54pm
3
Please do not crosspost artane.
system
February 12, 2004, 6:59pm
4
my apologies. It won’t happen again.
artane