/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
playlist_arr = new Array(); playlist_xml = new XML(); playlist_xml.ignoreWhite = true; playlist_xml.onLoad = function(success) { if (success) { var startTime = getTimer(); var track_xml = playlist_xml.firstChild.firstChild; while (track_xml != null) { // add the track data to our playlist! playlist_arr.push(getTrackData(track_xml)); track_xml = track_xml.nextSibling; } trace("Total parse time: " + (getTimer()-startTime)); } else { trace("Error loading playlist."); } delete playlist_xml; } function getTrackData(track_xml) { var trackData = new Object(); var data_xml = new XML(); data_xml = track_xml.firstChild; while (data_xml != null) { trackData[data_xml.nodeName] = data_xml.firstChild.nodeValue; data_xml = data_xml.nextSibling; } return trackData; } playlist_xml.load("playlist.xml");
URL: http://www.darronschall.com/weblog/archives/000065.cfm