Super Easy – Load Multiple RSS Feeds Into Flash

This an update to a post I wrote about loading multiple RSS feeds into Flash. In the old way I used a proxy PHP script and some other AS3 techniques, none of them are wrong, I just think this technique is a lot easier. If you have never used Yahoo Pipes, check it out. Yahoo Pipes is easy to use and you can create ridiculously complex data feeds with it. I’m not going to write a tutorial on Yahoo Pipes, there are tons of great tutorials online. Download the Flash files to this project here.


I’ll explain this pipe from the top down. I added three RSS feeds (Amazon, Twitter and this website M21M), I truncated each feed to 10, I didn’t want my twitter user name to show up 100 times so I replaced it with nothing (you can do the same or replace it with an image or go as crazy as you want), then I did a union on the feeds and sorted them by date published. That creates one RSS feed. Save it, run it and grab the URL. Change the URL, http://pipes.yahoo.com/ to http://pipes.yahooapis.com/ and you’re good to go. You don’t need a proxy file to load your RSS file because yahoo has a crossdomain policy for Flash.

Here’s the ActionScript code.

package com.m21m{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.display.Loader;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.TextFormat;
	import com.m21m.util.Scroll;
	public class RSSReader extends MovieClip {
		private var RSS_URL:String="http://pipes.yahooapis.com/pipes/pipe.run?_id=2699f2f60ac7027fa560a539dde7d1f5&_render=rss";
		public function RSSReader() {
			var xmlURLLoader:URLLoader = new URLLoader();
			var xmlURLRequest:URLRequest=new URLRequest(RSS_URL);
			xmlURLLoader.load( xmlURLRequest );
			var sb:Scroll=new Scroll(main_mc);
			xmlURLLoader.addEventListener( Event.COMPLETE , dataLoaded );
		}
		private function dataLoaded(event:Event):void {
			var myXMLData:XML=new XML(event.target.data);
			var xmlList=myXMLData..item;
			for (var i:int=0; i<xmlList.length(); ++i) {
				var feed_mc:Feed = new Feed();
				feed_mc.feed_txt.htmlText="<a href='"+xmlList[i].link+"'>"+xmlList[i].title+"</a>";
				main_mc.content_mc.addChild(feed_mc);
			}
			orderFeeds();
		}
		private function orderFeeds() {
			//loop through the feeds and stack them
			for (var i:int=1; i < main_mc.content_mc.numChildren; i++) {
				main_mc.content_mc.getChildAt(i).y=main_mc.content_mc.getChildAt(i-1).y+main_mc.content_mc.getChildAt(i-1).height+1;
			}
		}
	}
}

Of course this is just a quick sample Flash file you can customize the graphics and go as crazy as you want with Yahoo Pipes.



Again you can download the source here. Good luck and if you have questions ask them in the comments.

March 1st, 2010 | Categories: Actionscript |

Leave a Comment


Make sure you enter the *required information where indicated.








I don’t think Yahoo Pipes instantly gets the feed. There might be a refresh rate setting in pipes, but I’m not sure. The other alternative, if you need instant, is to load your own RSS feeds. Hope that helps.

Comment by admin — January 25, 2011 @ 7:49 am

Hey Great Tutorial.
I am having only one problem…
when i set up my pipe and change the link within the as3 code it works….
now when I update my twitter it doesn’t update the feed…it only shows the tweets published while creating the pipe…
Can you please help?

Comment by pav — January 25, 2011 @ 4:03 am

Yahoo Pipes has their own crossdomain.xml file and the URL (pipes.yahooapis.com) hosts it.

Comment by admin — March 3, 2010 @ 1:17 pm

No proxy file. I like!
How did you know you had to change the URL from http://pipes.yahoo.com/ to http://pipes.yahooapis.com/? And why is that?

Comment by Johnny Scissor — March 2, 2010 @ 3:23 pm