Hi all…
I’m trying to load mp3 files from an xml playlist but they are not playing when I want them to. All the mp3’s are in the same directory as the swf and play ok when I simply load them with a basic Sound object, but not when I try and load them from the xml file.
Here is my xml:
<Mp3Player>
<Song Artist="blah" Title="blah" Path="track1.mp3" />
<Song Artist="blah" Title="blah" Path="track2.mp3" />
<Song Artist="blah" Title="blah" Path="track3.mp3" />
</Mp3Player>
And my Actionscript:
[AS] var tracks:XML = new XML();
tracks.onLoad = function(success){
if(success){
//This traces all the paths and works fine
for(var i = 0; i < tracks.firstChild.childNodes.length; i++){
trace(tracks.firstChild.childNodes*.attributes.Path);
}
var s:Sound = new Sound(this);
s.loadSound(tracks.firstChild.childNodes[0].attributes.Path, true);
}
}
tracks.load(“tracks.xml”);[/AS]
Basically, all I’m trying to do is get track1.mp3 to play when the xml file has loaded, but I can’t understand why it doesn’t!!
Any help will be much appreciated
Thanks in advance
JUD