Be the first to write a review
Consuming RSS feeds with Flash 8
So far in this series of articles about Web 2.0, we’ve looked at several ways to create Ajax-style applications. In this article, we’ll look at Flash and use it to consume RSS feeds. Like Ajax, Flash allows you to refresh one part of the interface in a Web page without reloading the entire page.
Due to security restrictions, Flash can’t consume data from an external source in another domain. So we’ll need to use a server-side file to proxy the RSS feed locally. That way, Flash will think that the data is located in the same domain as the SWF file. I’ll proxy the data using an ASP .NET file but you could also use PHP, ASP or ColdFusion for this task. If you want to find out more, you can read the TechNote at the Adobe Web site - http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16520.
Because we’ll be using a server-side file, you’ll need to run this example through a Web server. I’ll be using IIS (Internet Information Systems) on a PC but you could use other Web servers. You’d just need a different proxy file. In IIS, all Web sites exist as a folder in C:\Inetpub\wwwroot and I’ll be using the folder DMXZone at that location. I have to use http://localhost/DMXZone in the address to load the Flash file correctly.
The tutorial is written using ActionScript 2 and Flash 8. It doesn’t use a class-based approach. Rather, it uses a series of functions located within the Flash file. I’ve done this for simplicity as many people starting with Flash don’t come from a programming background and find it tricky to work with classes.
You can download the files for the article from the blue Properties box that contains the article PDF. There's a heading titled Code Download and you can click the Details link next to it to get the zip file.
Note: If you have difficulties downloading the source files or PDF, you might have a problem with your cookies. Delete the cookies from your machine and try again. In Internet Explorer, you can do this by choosing Tools > Internet Options… and clicking the Delete Cookies… button on the General tab.
Getting started
Download the resource files and copy them to a folder called DMXZone within your Web server. Open the starter file FlashRSS_starter.fla in Flash 8. You can see that the interface consists of a ComboBox component that we’ll use to display a list of feeds. It also includes a TextArea component with the html property set to true in the Parameters panel. That will allow us to include simple HTML tags in the items.
When you publish this file, it should look something like the following screen shot – not pretty but very functional!
Sas Jacobs
Hello. I'm the Principal of Anything Is Possible, an Australian web development business specialising in web applications development and training. I'm interested in using Flash with dynamic content and I've presented at a number of International conferences on topics relating to applications development, XML and scripting components. I have recently released my second print book Beginning XML with DOM and Ajax to match the first one - Foundation XML for Flash. I have a business web site
and a personal web site.