Changing RSS source feed dynamically
This tutorial explains how to change the RSS source feed dynamically using the Flash MX combobox component.
If the RSS source files do not reside on the same server as the SWF, you should first prepare the necessary permission files for the URL's of the RSS data feeds that you will be accessing. You should have one file for each RSS file that you will be accessing remotely. This procedure is described in the section entitled
Important Flash security instructions.
Note: In the following tutorial we refer to both the rssReader and the rssReader-FT components as the "rssReader"
1. Set up the the rssReader component together with a textfield, textarea or the flashTicker as explained in the earlier tutorials.
2. Give the rssReader that's on your stage an instance name, for example: myRSS
3. Drag and drop the ComboBox component from the components panel onto the stage. The ComboBox component is located under "Flash UI Components". Give this ComboBox an instance name, for example: rssCombo
4. Select the ComboBox that you just placed on your stage and set the following parameters:
| Parameter | Description | Example |
| Labels | List of titles that the user will choose from for each RSS feed. | BBC World News, New York Times, Yahoo Entertainment News |
| Data | Links to the RSS feeds. If you are using permission files as described in the security guidelines then you should specify the path to these files here. | http://www.yoururl/rssfeeds/bbc.php, http://www.yoururl/rssfeeds/nyt.php, http://www.yoururl/rssfeeds/yahoo.php |
| * Change Handler | The function that will be accessed when the selection is changed by the user. | changeFeed |
* This parameter should be set when using the Flash MX
ComboBox only, it does not exist in the Flash MX 2004 ComboBox properties.

In Flash MX Only (see below for Flash MX 2004 instructions):
5. It's now time to create the function that you specified in the Change Handler parameter. This function will be accessed automatically whenever the user selects a new item in the ComboBox. The function will change the source feed of the rssReader.
Add the following ActionScript code to your main timeline. This code should be placed in frame 1.
changeFeed = function() {
var item = rssCombo.getSelectedItem();
var content = item.data;
myRSS.rssSource = content;
myRSS.reload();
};Note: If, for example, you are using the ultimateScroller, and the rssReader component is located inside a movie clip, you must adjust the code above to call the rssReader inside the movie clip. For example:
changeFeed = function() {
var item = rssCombo.getSelectedItem();
var content = item.data;
scrollerMC.myRSS.rssSource = content;
scrollerMC.myRSS.reload();
};In the above example, scrollerMC is the name of the movie clip that contains the rssReader component.
In Flash MX 2004:
5. Add the following code to frame 1 of your timeline:
feed = new Object();
feed.change = function (evt){
myRSS.rssSource = evt.target.selectedItem.data;
myRSS.reload();
}
rssCombo.addEventListener("change", feed);
Note: If, for example, you are using the ultimateScroller, and the rssReader component is located inside a movie clip, you must adjust the code above to call the rssReader inside the movie clip. For example:
feed = new Object();
feed.change = function (evt){
scrollerMC.myRSS.rssSource = evt.target.selectedItem.data;
scrollerMC.myRSS.reload();
}
rssCombo.addEventListener("change", feed);In the above example, scrollerMC is the name of the movie clip that contains the rssReader component.
You can now test your movie to ensure that everything is working correctly.