RSS feed scroller
Description: Read an RSS feed and scroll it, displaying the titles which are clickable to the full story
Author: John Bezanis
Added: March 4th 2007
Version: Flash 8
Total Views: 13060
Views in the Past 7 Days: 182
This flash feed reader can be used either as is, or customized by changing the actionscript. If you simply want to use this feed reader for your site, save the SWF file to your website, and copy the following code:
<object data="23-rssscroller.swf?feed=http://www.bezzmedia.com/swfspot/rss.php" type="application/x-shockwave-flash" width="600" height="20"><param name="movie" value="23-rssscroller.swf?feed=http://www.bezzmedia.com/swfspot/rss.php"/></object>
Rename 23-rssscroller.swf (the blue text) to where ever the swf is located on your website. Change the red text to the location of your RSS feed.
The entire feed reader is generated in actionscript, so simply copying and pasting the code below is all that needs to be done. A few interesting lines:
1. var movementspeed=2; This sets the scroll speed10. scrollingtext.textColor = 0xFF0000; Set the color of the text- //Movement speed of the feed
- var movementspeed=2;
- //Fit the feed into the flash box, no matter what size it is set to.
- Stage.scaleMode="noBorder";
- //Create the feed textbox
- this.createTextField("scrollingtext", this.getNextHighestDepth(), 0, 0, Stage.width, Stage.height);
- //One line in height
- scrollingtext.multiline = false;
- //Color of the text
- scrollingtext.textColor = 0xFF0000;
- scrollingtext.wordWrap = false;
- //Use html to enable links within the text
- scrollingtext.html = true;
- //default text before the feed has loaded
- scrollingtext.htmlText = "loading ";
- //fill the screen with loading text
- while(scrollingtext.maxhscroll<Stage.width){
- scrollingtext.htmlText+=scrollingtext.htmlText;
- textlength=scrollingtext.maxhscroll;
- }
- //create the xml object
- xmlLoad = new XML();
- //load the feed. This is grabbed from the GET parameter "feed"
- xmlLoad.load(_root.feed);
- xmlLoad.ignoreWhite = true;
- //When the XML file has fully loaded, change the text
- xmlLoad.onLoad = function(success){
- //if successful
- if(success && xmlLoad.status == 0){
- //reset the text
- textfield="";
- //List of items
- var xmlItems:XML = xmlLoad.firstChild.firstChild;
- for (var m = 0; m<xmlItems.childNodes.length; m++) {
- //grab each item
- if (xmlItems.childNodes[m].nodeName == "item") {
- for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) {
- if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
- //grab the link of the item
- itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
- }
- if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
- //grab the title of the item
- itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
- }
- }
- //add the current item to the feed scroller
- textfield+= "<a href=\""+itemlink+"\">"+itemtitle+"</a> - ";
- }
- }
- //if there are no items in the feed, set it to " " to show an empty feed
- if(textfield==""){
- textfield=" ";
- }
- //set the text
- scrollingtext.htmlText=textfield;
- //reset the scroll position
- scrollingtext.hscroll=0;
- //fill the screen with the feed, just in case it is too short to create a constant stream
- while(scrollingtext.maxhscroll<Stage.width || textlength!=scrollingtext.maxhscroll){
- scrollingtext.htmlText+=scrollingtext.htmlText;
- //for some unknown reason, scrollingtext.maxhscroll is not updating automatically.
- //Maybe someone can clue me in to why this is happening
- //This is a nasty hack.
- textlength=Number(scrollingtext.maxhscroll);
- }
- }else{
- //Uh oh. Something bad happened and the file didn't load
- scrollingtext.htmlText="error ";
- scrollingtext.hscroll=0;
- while(scrollingtext.maxhscroll<Stage.width || textlength!=scrollingtext.maxhscroll){
- scrollingtext.htmlText+=scrollingtext.htmlText;
- textlength=Number(scrollingtext.maxhscroll);
- }
- }
- }
- onEnterFrame=function(){
- //Scroll the text
- scrollingtext.hscroll=((scrollingtext.hscroll+movementspeed)%(textlength+Stage.width));
- }
The source file is available below for download.
Download Source File
Questions and Suggestions
hi
i test it and finnally i get the resull :
loading loading loading and then error error error
please juste explain more to modify exactyl.
and all the links RSS ends with .rss (no like u done .php)
thnks
May 20th 2007 05:05AM - kirom
First, check if your feed is valid. Check here:
http://feedvalidator.org/ If it is valid, make sure you use the absolute path to your feed. Example: http://www.bezzmedia.com/swfspot/rss.php not just rss.php
May 23rd 2007 05:05AM - John
i have tried copy pasting the swf's onto my site with no success. i noticed that the object code your have specified as copy, modify the red text and paste is different than the source code for this site of the odject class on this site
any suggestions?
May 24th 2007 13:05PM - JFer
Post the link, either I or someone else can probably help out.
May 25th 2007 05:05AM - John
Thank you for responding so quickly, i have been using CS3 to do this project, i had tried saving it as a FLA 8, with the same negative results. THis is by far, the best scroller i have seen so far
May 25th 2007 09:05AM - JFer
Here's the problem. What is the address of the rss feed? In the places your html code says 23-rssscroller.swf, change it to 23-rssscroller.swf?feed=http://www.siteaddress.com/addressoffeed.rss
That way the flash plugin knows where to grab the feed from.
May 25th 2007 14:05PM - John
I done it:)
but i need some space between two different news please help me about this.
May 29th 2007 05:05AM - Xtreme
I cant done it it shows in frontpage but not in ie.
May 29th 2007 05:05AM - XTreme
Hi,
i tried making the changes you suggested, but to no avail
do i have to configure any security settings perhaps?
June 1st 2007 14:06PM - JFER
the link http://www.koarise.com/nasa.rss does not work. That's the problem.
June 1st 2007 18:06PM - John
Hi,
thanks for all your feedback, your tutorial is the only one that has worked for me so far, i greatly appreciate all your help John.
I would like to link my rss from other sites, but i noticed that this cross domain linking is no longer available
do you know any work a rounds?
also, i've tried modifying the font by using
scrollingtext.font = "Zurich BlkEx BT";
the font does not change though, do i need to embed it some how?
June 4th 2007 10:06AM - JFer
To place your rss feed onto other sites with flash, you'd need to have a crossdomain.xml file set up. Read more at http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213 or google "flash crossdomain.xml". Changing the font: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002807.html
June 4th 2007 20:06PM - John
Nice Job! I hacked a way to stop the RSS scroll on RollOver, but I'm looking for a way to change the color of the links as they are rolled over and I'm stumped. Any ideas?
June 5th 2007 15:06PM - CG
Found a solution to the rollovers. I imported an external css style sheet and applied it to the textfield.
June 7th 2007 11:06AM - CG
fla is not supporting.. its old version i think. i have flash 7.
July 20th 2007 01:07AM - neelan
Is there a way to load the RSS feed from within Flash, instead of specifying it when embedding it into a page?
if possible, email answer to animetricproductions at gmail?
Thanks.
August 8th 2007 09:08AM - SQ
Hi, I got this working nicely but didn;t understand your link to How to change the font... Could you pls explain? Also, CG mentioned he had used an external CSS attached to the textfield... How do I do this?
Cheers!
August 29th 2007 12:08PM - Matt
To change the font, you first need to have the text set. Add the folowing code at the end of the xmlLoad.onLoad function (line 76).
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Some Font";
scrollingtext.setTextFormat(my_fmt);
August 29th 2007 20:08PM - John
John thanks that worked - but only when I just look at the SWF... ie. when I publish a preview from Flash it's in the font I specify. When I embed the SWF into HTML the font reverts to Times. Any idea why?
August 30th 2007 08:08AM - Matt
Any way to change the background color for the scroller, also need to specify a size of 700 pixels in length and 25-35 pixels high. Any ideas would be appreciated. Thank you
September 4th 2007 19:09PM - ispgeek
Okay I feel stupid...I just missed the sizing specs above so only need to specify background color for text box. Sorry for the lameness.
September 4th 2007 19:09PM - ispgeek
Hi.Is it possible and how instead of xmlLoad.load(_root.feed); to use external RSS URL address to swf as standalone. Thank you
October 7th 2007 22:10PM - Papy
Papy, change feed=http://www.bezzmedia.com/swfspot/rss.php in the html to the address of your feed.
October 9th 2007 13:10PM - John
Hi.Maybe did not ask right question. I'd like to use the swf file without html page. just like a standalone swf. is that possible?
October 9th 2007 15:10PM - Papy
Change xmlLoad.load(_root.feed); to something like xmlLoad.load("myfeed.xml");
October 9th 2007 15:10PM - John
Thank you for the answer. I'm new in that so I'd like to ask you what the xml(let's say myfeed.xml) file need to content. i'v got my exact RSS URL. Thank you
October 9th 2007 23:10PM - Papy
Hello John,
your rss-scroller is exactly what i need..
but.. it dosen`t work somehow.. all what the reader do is "loading.."
do you have any idea why could not work?
for test i`ve even taken your .swf and your rss-feed
and still nothing..I´m sure there is an easy explanation.. but I just don`t get it..
an embed problem ?
I don`t know..
November 13th 2007 11:11AM - apprentice
If it was a recent log on here I would even have bothered...strange things is I can't get it to work simple loads nada, not evne with original feed...I run vista 64 this should mater but I had weirder stuff happen, anyone a suggestion?
November 29th 2007 11:11AM - Marcus
Okay I figured out that one can't use CS3 I have now saved the fla as an Flash8 file, hoeveve I still get error error msg with the feed exactly as mentioned above, anyone can help?
November 29th 2007 12:11PM - Chris
Can any one mail the way to worked it out...and the update such as CSS sheet capability,it will be very much aprreciated ;-) dutchmarcus@gmail.com
November 29th 2007 12:11PM - Chris
I'm trying to scroll the EDGAR-online RSS feed for SEC filings and getting "loading error error . . . etc." The feed address is:
feed://feeds.edgar-online.com/latestFilings/Default.aspx?channel=ALL
I'm using your 23-rssscroller.swf and past the following into my html file:
<body>
<object data="23-rssscroller.swf?feed=feed://feeds.edgar-online.com/latestFilings/Default.aspx?channel=ALL" type="application/x-shockwave-flash" width="600" height="20"><param name="movie" value="23-rssscroller.swf?feed=feed://feeds.edgar-online.com/latestFilings/Default.aspx?channel=ALL"/></object>
</body>
If it'll help, my test html on my Web site is:
http://www.rickbennett.com/EDGAROnline/EDGARamazonGOOGLErssfeed.html
Many thanks.
November 30th 2007 12:11PM - Rick
Last message too obtuse without paragraph spacing. I get "loading error error . . ." when I past your feed link into my html. The feed (just so you can see that it's a good feed) is: http://feeds.edgar-online.com/latestFilings/Default.aspx?channel=CURRENT
November 30th 2007 15:11PM - Rick
Rick, The problem is that the swf file and the rss feed are on two different domains. edgar-online needs to write a cross-domain policy file to allow other domains to read their rss feeds. This is a built in security feature to flash. More info here: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&sliceId=2
November 30th 2007 22:11PM - John
Ahhhhhhh . . . you know, there has GOT to be a way around this. Flash is so robust, yet to have this kind of limitation really does invite subversion of such a stupid policy. In the meantime, looks like I've got to go with the Sanrio Flash reader. Check out this code:
http://www.rickbennett.com/EDGAROnline/SanRioFlashReader.html
November 30th 2007 22:11PM - Rick
You could read the rss file into your server and spit it back out to the flash file from your server.
December 1st 2007 02:12AM - John
Thanks, John. I'll give that a shot. Merry Christmas.
December 1st 2007 10:12AM - Rick
I see that people have been halping each other, however mine request right above has till now been ignored can anyone offer assitence?
I am getting error error, and folowng the instuctions precies, am I missing anything?
December 6th 2007 09:12AM - Chris
Chris, do you have an online link we would look at?
December 6th 2007 12:12PM - John
My Webmaster placed this scroller on my site with sample text scrolling.
In plain step-by-step English, how do I change the text with my own words?
Thanks!
G.
December 9th 2007 18:12PM - Geoff
Hi John,
Yeah I do :-)
Idea is to run in an exsisting flash banner,
site is for a kraanworker, in NL, he liked the news and weather report to scroll, link to test page is
http://www.vanjolekraanservice.nl/archieved/test.htm
I haver an other problem with a flash banner which is on
http://www.vanjolekraanservice.nl/archieved/rss.htm
Thank you very much,
Chris
December 10th 2007 05:12AM - Chris
What if I want only a certain amount of feed to show? Like, 3-6?
December 15th 2007 16:12PM - Matt C.
how can i load the feed directly in flash without the html file? i saw this asked up above, but couldn't find the answer. nothing i've been trying is working yet. thanks!
December 17th 2007 18:12PM - gretchen
I can make the scroller work with this feed "http://www.bezzmedia.com/swfspot/rss.php" but the feed I want to use is "http://www.550thezone.com/script2/rss.php?f=104670" but no luck.
December 18th 2007 21:12PM - matt
i got this to work the way i want, i thought, but the feed stops moving after about 5 minutes of being open. any idea why?
January 9th 2008 14:01PM - gretchen
how do i insert images(scrolling logo) in between news feed?
January 14th 2008 21:01PM - donpobre
Any word on changing the font, I read link and added code but nothing seems to be working...any feedback on this?
January 21st 2008 20:01PM - Simon
Fixed the font issue.
Is there any way of specifying that the link opens in a _blank target? Cheers.
January 21st 2008 22:01PM - Simon
My titles are not clickable? How can I fix this?
January 22nd 2008 21:01PM - Clark
I have one problem. When I use this adress http://wiadomosci.onet.pl/2,kategoria.rss everything is ok but when I change adres to http://www.chip.pl/rss/newsroom.rss rss feed scroller don't load this rss.
January 27th 2008 10:01AM - lukasz
Hi I am having a problem as well. After about 2 mins the feed just stops completely. Is there any way to fix this? Thanks so much :)
January 27th 2008 22:01PM - mira
I am having the same problem as a few above. With the feed stopping scrolling after around 2-5 minutes.
Please advise.
February 14th 2008 13:02PM - Dave
this tutorial is helpfull for me, but when loadMovie on my flash document on target, i can adjust the size the font with command "fscommad('allowscale",false)...anyone can help this
February 18th 2008 05:02AM - iyunk
Could anyone please tell me why it won't load this feed?:http://www.bezzmedia.com/swfspot/resources/23-rssscroller.swf.
March 19th 2008 22:03PM - Matt C.
<bold>Could anyone please tell me why it won't load this feed?:http://www.bezzmedia.com/swfspot/resources/23-rssscroller.swf.</bold>
March 19th 2008 22:03PM - MC
My other 2 posts were mistakes. I meant this feed: http://www.blogengage.com/rss.php
March 19th 2008 22:03PM - MC
MC, It's getting messed up because you are using a php extension. Here's your code: <?phpxml version="1.0" encoding="utf-8"?>
try changing that line to <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
March 20th 2008 05:03AM - John
Hello John,
I used your code on this web site. It worked fine locally. Can you please let me know why this is not working.
Thanks,
Sam.
March 31st 2008 17:03PM - Sam
Sam, Edit your html so http://www.bezzmedia.com/swfspot/rss.php is the location of your xml file.
April 1st 2008 03:04AM - John
John,
I am just using plain HTML without any XML code.
How should I make http://www.bezzmedia.com/swfspot/rss.php, the location of my xml file.
I will really appreciate your response.
Please let me know.
Thanks,
Sam.
April 1st 2008 07:04AM - Sam
How come it won't load this feed: http://sf-zone.net/wp-atom.php?
April 22nd 2008 01:04AM - MC
MC, It might have something to do with the javascript.
April 22nd 2008 09:04AM - John
I've found that it only loops twice – how do we make it loop continuously? Thanks!!
May 21st 2008 19:05PM - CL
hi, when i test the feed from my computer (directly from flash, i side stepped the get variable by doing this: xmlLoad.load("myfeed.xml");) it works 100% , but the moment i upload it to a server, or even test it locally in my browser, it gives me the error message.
i tried everything and have no idea what the problem could be. if there is anyone who can help me, please do so! thanks.
June 4th 2008 04:06AM - jana
Jana, instead of "myfeed.xml", try using the absolute path, like "http://www.mysite.com/myfeed.xml", or "http://localhost/myfeed.xml" for a local server.
June 4th 2008 04:06AM - John
thanks for your quick response, John, but maybe i should have copied the whole line, and not just an example.
i am using the absolute path: xmlLoad.load('http://www.aviationweek.com/services/rss/retrieve?site=anc&pubname=aviationdaily');
i have also tested the feed on http://feedvalidator.org, its working 100%. the thing that baffles me is that it's working as a standalone player, but not through a browser...?
June 4th 2008 05:06AM - jana
It's possible there is a cross domain policy issue. Is the swf file hosted on the same domain as the xml file?
June 4th 2008 05:06AM - John
i also thought it could be something like that. i'll see what i can do. thanks again.
June 4th 2008 05:06AM - jana
Add a Question or Suggestion







