// Setup sound object
var s:Sound=new Sound();
s.onSoundComplete= playSong;
s.setVolume(75);
// Array of songs
var sa:Array=new Array();
// Currently playing song
var csp:Number=-1;
// Load the songs XML
var xml:XML=new XML();
xml.ignoreWhite=true;
xml.onLoad=function()
{
var noads:Array=this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
sa.push(nodes[i].attributes.url);
}
playSong();
}
xml.load("songs.xml");
// Play the MP3 file
function playSong():Void
{
if(cps==sa.length-1)
{
cps=0;
s.loadSound(sa[cps],true);
}
else
{
s.loadSound(sa[++cps],true);
}
}