Flash AS3: Processing RSS Feeds – Part 2
March 28, 2010

This post continues the topic of reading and parsing RSS2 feeds which were discussed in the previous post and can be found here:

Building from the example in that post, we will do the following improvements here:

  • Cycling though posts.
  • Enabling users to read the full post.

To begin with, we added two buttons into the Flash movie:

  • nextButton to enable cycling through posts
  • readFullPostButton to enable opening the full post in a new browser window.

The buttons are shown below:

They are regular Button (can also be MovieClip) and we are giving their instance the name of nextButton and readFullPostButton respectively.

Attaching Listeners To The Buttons

Add the two new lines (line 21 and 22) to intercept buttons click. For this example, I am adding it at the end of onXMLFileLoaded function. I also hid the buttons until the RSS XML data has been loaded (line 2 and line 3).

// Hide the buttons for now until the RSS data is loaded.  We don't want user clicking on them before the RSS is ready.

* Called when the XML data has been loaded.
function onXMLFileLoaded(e:Event):void
	myXML=new XML(;

	// Make the buttons visible

	// Add listeners to the buttons
	nextButton.addEventListener(MouseEvent.CLICK, onNextButtonClicked);
	readFullPostButton.addEventListener(MouseEvent.CLICK, onReadFullPostButtonClicked);

Handling the nextButton

This button needs to know how many posts are in the RSS feed, so that we can cycle back when user is in the last post. We stored this variable earlier in numberOfPosts variable.

function onNextButtonClicked(event:MouseEvent):void
	// Increment post index

	// Cycle back to the first post if we are at the last index
	if (currentPost>=numberOfPosts)


This button just needs to open a new browser window and displays the full post and lucky for us, the URL of the full post is already available in the RSS, within[currentPost].link node.  navigateToURL is used toopen the post in a blank browser window.

function onReadFullPostButtonClicked(event:MouseEvent):void
	navigateToURL(new URLRequest([currentPost].link), "_blank");



You can download the example FLA here.