Myspace Flash AS2 RSS Feed Reader
22 August 2008 | 3,335 views | View Comments
A very simple RSS feed reader that displays links off to your blog created using Actionscript 2.
stop();
//create the xml object
xmlLoad = new XML();
xmlLoad.load(_root.feed);
xmlLoad.ignoreWhite = true;
xmlLoad.onLoad = function(success){
//if successful
if(success && xmlLoad.status == 0){
//reset the text
xml_text="";
//list of items
var xmlItems:XML = xmlLoad.firstChild.firstChild;
for (var m = 0; m<xmlItems.childNodes.length; m++) {
//grab each item
if (xmlItems.childNodes[m].nodeName == "item") {
for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) {
if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
//grab the link of the item
itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
}
if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
//grab the title of the item
itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
}
}
//add the current item
xml_text+= "<a href=\""+itemlink+"\">"+itemtitle+"</a><br><br>";
}
}
}
//set the text
xml_holder.text = xml_text;
}
The only library item needed is a TextArea component, placed on the stage with an instance name of “xml_holder”.
In order to embed and display this on your Myspace page (or anywhere really) you only need the following code:
<object data="http://www.derekentringer.com/downloads/xml_reader/xml_reader.swf?feed=http://www.derekentringer.com/blog/feed/" type="application/x-shockwave-flash" width="300" height="450"><param name="movie" value="http://www.derekentringer.com/downloads/xml_reader/xml_reader.swf?feed=http://www.derekentringer.com/blog/feed/"/></object><br />
Be sure to change the “?feed” variable to the url of your own RSS feed.





