// VARIABLES _level0.error._visible = false; // Hide the error message var feedArray = new Array(); var blogArray = new Array(); main(); // Call the main function to get this going // function: main // Description: Runs the program // Output: void function main() { getFeedArray(); // Get the feed array from the XML file } // function: getFeedArray // Description: Fetches the feeds from an xml file // Output: Array function getFeedArray() { var feed_file = "feed_selector.xml"; // Select xml file var feed_xml = new XML(); feed_xml.ignoreWhite = true; feed_xml.onLoad = function(success) { if (success) { var array = processFeeds(feed_xml.childNodes,0); _level0.feedArray = array; }else{ //DISPLAY ERROR MESSAGE _root.loading._visible = false; _root.error._visible = true; trace("can't fetch blog, try again"); } }; feed_xml.load(feed_file); // Load xml } // function: processFeeds // Description: Processes the XML file // Input: Root XML Child // Output: Array function processFeeds(xmlitems, childnum) { var child = xmlitems[childnum]; switch(child.nodeName) { case "feed": var str = child.firstChild.nodeValue; // Gets the feed string //trace(str); return "http://" + str.substring(7, str.length); // Replaces 'feed://' with 'http://' break; case "feeds": feedArray = Array(); for(var d=0;d