I am currently building an RSS news reader in flash and have run into the slight problem of not being able to access the correct nodes within the XML files. I have managed to parse the first nodes for the XML file info eg BBC RSS file (using; this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue), but when i try and change the nodes that are accessed, eg childNodes[1], to access the main body of the file info, i get a ‘undefined’ result.
Racking my brains, and any help would be much appreciated, thanks!
I’ve written an RSS class. I have attached the entire class file here. I use it all the time to parse information from RSS 2.0 feeds. It should do everything for you automatically. Copy the object into your program directory in (ie. C:\Program Files\Macromedia\Flash 8).
Once you’ve found that directory go into en\First Run\Classes\
Then add it to FP7, FP8, and/or mx (depends on which version your player is compiled to). Copy everything into com folder close Flash and restart it. …then try this.
import com.simplifiedsoftware.rss.*;
var RSSObj:RSS = new RSS();
var rssListener:Object = new Object();
rssListener.onRSS = function (eventObj:Object):Void {
trace(eventObj.status);
trace(eventObj.success);
if(eventObj.status ==0 && eventObj.success) {
trace(eventObj.rss.Version);
// Outputs the version of the RSS feed.
trace(eventObj.rss.Title);
// Outputs the title of the RSS feed.
trace(eventObj.rss.singleItem(0).Title);
// Trace the first item in the feed's title.
}
}
RSSObj.addEventListener("onRSS", rssListener);
RSSObj.load("pathToRSSFeed.xml");