for the following xml sheet:
<playlist>
<cd thumb =“album_music/image.gif” albumtitle=“album1” artistname=“yoohoo” tracktitles=“blah blah”>
<mp3file file=“album_music/Angel.mp3”/>
…other mp3 files…
</cd>
…other cd nodes like above…
</playlist>
I have the following actionscript to navigate between each cd to play tracks within.
i need the on release function to be corrected for me so that when u click on the icon - THE PARTICULAR cd is played which the icon represents. right now my on release function plays the first mp3 of the first cd no matter which icon u click on.
help please!
var item_spacing = 110;
var item_count = 0;
var tracklist = new Array();
var menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(success){
if (success) {
var items = menu_xml.firstChild.childNodes;
for (var i=0; i<items.length; i++) {
var cd = items*;
var pic = items*.attributes.thumb;
var tracks = items*.attributes.tracktitles;
var artist = items*.attributes.artistname;
var albumName = items*.attributes.albumtitle;
var item_mc = menu_mc.attachMovie("item_panel","item"+item_count, item_count); // linkageID, name, depth
item_mc._y = item_count * item_spacing;
item_count++;
item_mc.artistDisplay.text = "Artist: " +artist;
item_mc.albumDisplay.text = "Album: " +albumName;
item_mc.tracklisting.text = tracks;
item_mc.icon_border.icon_mov.loadMovie(pic);
item_mc.icon_border.icon_mov._x= 0;
item_mc.icon_border.icon_mov._y= 0;
item_mc.icon_border.onRelease = function () {
playTrack();
}
}
var theTrack = cd.childNodes; //theTrack=song
for (var i=0; i<theTrack.length; i++) {
var currTrack = theTrack*.attributes.file; //track=currTrack
_root.tracklist.push(currTrack);
}
}
}
menu_xml.load("mix_playlist.xml");
// MEDIA PLAYER CONTROLS
function playTrack(){
_root.test_box.text= "hey";
stopAllSounds();
var x:Number = _global.trackNo;
var tlength:Number = _root.currTrack.length;
if (tlength <= x) {
//reset ffw counter
x = 0;
}
_global.trackNo = x;
_root.track = new Sound();
track.loadSound (menu_xml.firstChild.childNodes[0].childNodes[0].attributes.file, true);
}
please view www.ragemultimedia.com/theheadz/mixlisttest.htm
to see the webpage in question to get a better idea.