I have a quick XML question for you all. I’m calling news in through a rss feed from a content management system now, instead of manually updating a xml file and reuploading it making it easier for others to update the news. However, now instead of each news item loading individual, they are loading as 1 news item smushed together. I have been playing with the code, but haven’t gotten to the bottom of it yet so I was hoping some one here could give me a quick hand, thank you=)
here is the url to the RSS Feed: http://www.colettetrudeau.com/cutenews/rss.php?category=3
Here is the site in which it is loading so you can see what I mean by smushed: http://www.colettetrudeau.com
and here is my actionscript for loading the news
//news vars
var newsData:XML;//
var newsLoader:URLLoader = new URLLoader();
newsLoader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
newsLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
newsLoader.load(new URLRequest("http://www.colettetrudeau.com/cutenews/rss.php?category=3"));
var xmlNewsList:XMLList;
//End news
//start load news
function onComplete(evt:Event):void {
try {
newsData = new XML(newsLoader.data);
trace(newsData.channel.item.pubDate.text());
newsTextField.htmlText = newsData.channel.item.pubDate.text() + "
" + newsData.channel.item.title.text() + "
" + newsData.channel.item.description.text();
xmlNewsList = newsData.children();
trace("Number of News Items: " + newsData.length());
/*for (var n:int=0; n<xmlList.length(); n++) {
newsTextField.htmlText = xmlNewsList[n].item.title;
}*/
newsLoader.removeEventListener(Event.COMPLETE, onComplete);
newsLoader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace("An error occurred when attempting to load the SML.
" + evt.text);
}
//End news loader
Thanks for you help:cool:
Edit: odd, when I trace the pubDate I only get 1, but when I call it into my text box, I get them all
Edit: the trace on total number of news items shows 1 when it should be two