Hello Kirupians,
A problem makes me grow grey hair: I would like to randomly load a song from my xml list when entering my site.
After doing a search I figured out I could do it with a math.random? Ok.
But could someone point me in the right direction how to incorporate that in my function?
Thanks for any suggestions :).
function loadData(success) {
if (success) {
aPath = new Array();
songTitel = new Array();
songArtist = new Array();
songCover = new Array();
audioTracks = new Array();
audioTracks = this.firstChild.childNodes;
totalAudio = audioTracks.length;
for (var i=0; i<totalAudio; i++) {
if (audioTracks*.nodeName == "song") {
aPath.push(audioTracks*.attributes.path);
songTitel.push(audioTracks*.attributes.title);
songArtist.push(audioTracks*.attributes.artist);
songCover.push(audioTracks*.attributes.bild);
}
}
AudioPath = aPath[0];
titel = songTitel[0];
artist = songArtist[0];
aktAudio = 1;
trackAnzeige = aktAudio+" / "+totalAudio;
status = "STATUS: PLAYLIST - LOADED";
if (playerlook) setCover(0);
erstesBild = true;
setzeDirektwahl();
setzePlaylistwahl();
if (playatstart) playSong();
} else {
status = "STATUS: PLAYLIST - NOT LOADED";
}
delete audioTracks;
delete data_xml;
}