1 — Introduction
This tutorial outlines how to use Macromedia’s Flash MX 2004 together with the open source server scripting language PHP to create an RSS Reader.
By the end of this tutorial you will have produced something similar to this Flash movie plus you will have learned some optimized techniques for working with XML Objects in Flash MX 2004 using ActionScript 2.0.
What?The primary goal of this tutorial is to build a Flash movie that will load, parse and display RSS news syndication documents, making it easy to browse headlines and summaries of your own favorite collection of ’blogs.
As we trudge along towards that practical goal you will be exposed to quite a bit of information about working with XML documents in Flash and will be shown three viable strategies for targeting and extracting the content you want out of an XML document.
This tutorial requires Flash MX 2004 (the 7.2 “Elipsis” upgrade version is preferred), but not the Professional version. Powerful as they may be, we will not rely on any of the Remoting or Data Binding Components included with Flash MX 2004 Professional.
We will be writing a parsing Class. If you don’t own the Professional version (with its integrated text editor) you will also need a basic text editor to write the Class.
A smattering of PHP will also be involved. Not very complex PHP, but it is vital to the project.
This is a moderately advanced tutorial. It assumes at least a basic understanding of what XML is and some familiarity of the methods and properties of the XML and XMLNode Objects in Flash. If you learned any XML techniques in Flash MX using ActionScript 1.0 you will be pleased to know they all transfer to MX 2004.
If you do not feel you have at least a basic understanding of XML and Flash’s support for XML let me recommend two tutorials: Phil Chung (“Philter”) wrote a very clear and practical introduction which can be read at studiowhiz.com. The most in-depth treatment I have ever come across was written by Senocular and is located at kirupa.com. If you think I write lengthy tutorials, check out this 40-plus page masterpiece!
It’s no secret that anyone with a career or interest in any technical field today needs access to current information. The fresher that information is, the better. The last few years have witnessed an explosion of ’blogs and there is no fresher source of information than the ’blog. Long before a technique or observation or discovery is published in a tutorial or a magazine or a book, it is likely to be posted somewhere on the internet in a ’blog.
Contemporary ’blogging software is capable of automating the publication of RSS feeds, which summarize the current content of that ’blog. If you are a voracious consumer of ’blog-based information, you probably utilize a software product to organize and monitor your favorite ’blogs. One popular example of this type of software service is ’bloglines. Extensions to modern browsers are also available which display your favorite ’blogs in your browser’s sidebar.
These are powerful tools, indispensable to many of us, but they are private. They are for single users. What if you are a generous sort and want to share what you consider important news feeds with visitors to your site? I’m sure you are familiar with the standard page layout that places links to related sites in a narrow column to the right or left of the content area. That’s helpful, but it means that the visitor to your site has to leave your site to follow one of those links. What if you want to do more than link to good news sources? What if you want to make the content of those ’blogs available from your site?
One answser to that question is to become what is called an “aggregator” - you assemble a collection of what you consider worthy ’blogs, and you make summaries of their content available to visitors to your site.
This tutorial is going to demonstrate how to build a Flash application that permits you to become an aggregator. Along the way it also seeks to teach you some useful techniques for working with XML documents in Flash. Though nowhere near as feature-rich as commercial products (for example, there is no notification of when a ’blog has added new content), I have found that this reasonably simple ’blog reader serves my modest needs admirably.
Project files for this tutorial are available for download by clicking this link. You are certainly encouraged to download the files, but I will be disappointed in you if you don’t also read all the background information in the next twelve pages!
The tutorial follows the following structure:
- Parsing the Data
- Building the Movie
The preamble is finished. Let’s jump in by examining what this “RSS” stuff is all about.