Click to See Complete Forum and Search --> : Random Streaming


Phenomena
08-20-2007, 02:50 PM
I'm trying to set up a 'radio' type thing for my site halotrialmods.org. I know how to stream audio files, but I can't figure out how to make it so that a new song, from the song directory is played.

So for example, the page loads and Smoke on the Water is playing, then once that song is done play a new song is played, like Back in Black.

LeeU
08-20-2007, 03:08 PM
You can use a Flash player to do that.

mneil
08-29-2007, 02:49 PM
you can use onSoundComplete with the sound object to find out when a sound is finished playing, then you load the next. Store the directories in an array and go through the array 1 by 1.

var num:Number = 0;

var sArr:Array = new Array();
sArr[0] = "mysound1.wav"
sArr[1] = "mysound2.wav"
sArr[2] = "mysound3.wav"

function Next() {
num++
playSound();
}

function playSound(){
var s:Sound = new Sound();
s.attachSound(sArr[num]);
s.onSoundComplete = Next;
s.start();
}

playSound();