rendered paste bodyimport mx.xpath.XPathAPI;
function loadXML(loaded) {
if (loaded == false) {
content = "file not loaded!";
return;
}
var rssVersion:String = this.firstChild.attributes.version;
var xml_title:String = null;
var xml_description:String = null;
var stories:Array = new Array();
var currentNode:XMLNode = this.firstChild.firstChild.childNodes[0];
while (true) {
switch (currentNode.nodeName) {
case "title" :
xml_title = currentNode.firstChild.nodeValue;
break;
case "description" :
xml_description = currentNode.firstChild.nodeValue;
break;
case "item" :
var story:Object = new Object();
var subNode:XMLNode = currentNode.firstChild;
while (true) {
story[subNode.nodeName] = subNode.firstChild.nodeValue;
subNode = subNode.nextSibling;
if (subNode == null) {
break;
}
}
stories.push(story);
break;
}
currentNode = currentNode.nextSibling;
if (currentNode == null) {
break;
}
}
headline_txt.htmlText = stories[0].title;
story_txt.htmlText = stories[0].description;
headline_txt1.htmlText = stories[1].title;
story_txt1.htmlText = stories[1].description;
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.windowgain.com/antflash/rss/TopStories/topstories.php");