All pastes #952771 Raw Edit

Someone

public text v1 · immutable
#952771 ·published 2008-03-22 14:56 UTC
rendered paste body
// 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);
  }
}