Newest Articles

MegaCombs
Flash Media Player
XML Driven Pie Chart
Base Defender
Hangman Game
8 Ball Pool


Popular Articles

True Fullscreen Flash Mode
Mp3 Player with XML Playlist
Image Slider
Flash Media Player
3d Rotating Image Cube
Catapult Game


Random Articles

MegaCombs
Horizontal Line Transition
FLV Player
Moving Clouds and Waving Grass
Infinitely Zooming Image
3d Rotating Image Cube


Links

Foundation-Flash
MickM
TutorialQuest
Tutorialsphere.com - Free Online Tutorials
Newgrounds
TWiT
Link to SwfSpot
Swf Spot



rss feed

RSS feed scroller

RSS feed scroller
AddThis Social Bookmark Button
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


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 speed
10. scrollingtext.textColor = 0xFF0000; Set the color of the text
  1. //Movement speed of the feed
  2. var movementspeed=2;
  3. //Fit the feed into the flash box, no matter what size it is set to.
  4. Stage.scaleMode="noBorder";
  5. //Create the feed textbox
  6. this.createTextField("scrollingtext", this.getNextHighestDepth(), 0, 0, Stage.width, Stage.height);
  7. //One line in height
  8. scrollingtext.multiline = false;
  9. //Color of the text
  10. scrollingtext.textColor = 0xFF0000;
  11. scrollingtext.wordWrap = false;
  12. //Use html to enable links within the text
  13. scrollingtext.html = true;
  14. //default text before the feed has loaded
  15. scrollingtext.htmlText = "loading ";
  16. //fill the screen with loading text
  17. while(scrollingtext.maxhscroll<Stage.width){
  18.   scrollingtext.htmlText+=scrollingtext.htmlText;
  19.   textlength=scrollingtext.maxhscroll;
  20. }
  21. //create the xml object
  22. xmlLoad = new XML();
  23. //load the feed. This is grabbed from the GET parameter "feed"
  24. xmlLoad.load(_root.feed);
  25. xmlLoad.ignoreWhite = true;
  26. //When the XML file has fully loaded, change the text
  27. xmlLoad.onLoad = function(success){
  28.   //if successful
  29.   if(success && xmlLoad.status == 0){  
  30.     //reset the text
  31.     textfield=""
  32.     //List of items
  33.     var xmlItems:XML = xmlLoad.firstChild.firstChild;
  34.     for (var m = 0; m<xmlItems.childNodes.length; m++) {
  35.       //grab each item
  36.       if (xmlItems.childNodes[m].nodeName == "item") {
  37.         for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) {
  38.           if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
  39.             //grab the link of the item
  40.             itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
  41.           }
  42.           if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
  43.             //grab the title of the item
  44.             itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
  45.           }
  46.         }
  47.         //add the current item to the feed scroller
  48.         textfield+= "<a href=\""+itemlink+"\">"+itemtitle+"</a> - ";
  49.       }   
  50.     }
  51.     //if there are no items in the feed, set it to " " to show an empty feed
  52.     if(textfield==""){
  53.       textfield=" ";
  54.     }
  55.     //set the text
  56.     scrollingtext.htmlText=textfield;
  57.     //reset the scroll position
  58.     scrollingtext.hscroll=0;
  59.     //fill the screen with the feed, just in case it is too short to create a constant stream
  60.     while(scrollingtext.maxhscroll<Stage.width || textlength!=scrollingtext.maxhscroll){
  61.       scrollingtext.htmlText+=scrollingtext.htmlText;
  62.       //for some unknown reason, scrollingtext.maxhscroll is not updating automatically.
  63.       //Maybe someone can clue me in to why this is happening
  64.       //This is a nasty hack.
  65.       textlength=Number(scrollingtext.maxhscroll);
  66.     }  
  67.   }else{
  68.     //Uh oh. Something bad happened and the file didn't load
  69.     scrollingtext.htmlText="error ";
  70.     scrollingtext.hscroll=0;
  71.     while(scrollingtext.maxhscroll<Stage.width || textlength!=scrollingtext.maxhscroll){
  72.       scrollingtext.htmlText+=scrollingtext.htmlText;
  73.       textlength=Number(scrollingtext.maxhscroll);
  74.     } 
  75.   }
  76. }
  77. onEnterFrame=function(){
  78.   //Scroll the text
  79.   scrollingtext.hscroll=((scrollingtext.hscroll+movementspeed)%(textlength+Stage.width));
  80. }

The source file is available below for download.
Download Source File
Comments
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 01: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 02: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 02:06PM   -   JFER
the link http://www.koarise.com/nasa.rss does not work. That's the problem.
June 1st 2007 06: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 08: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 03: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 08: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 07: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 07: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 10:10PM   -   Papy
Papy, change feed=http://www.bezzmedia.com/swfspot/rss.php in the html to the address of your feed.
October 9th 2007 01: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 03:10PM   -   Papy
Change xmlLoad.load(_root.feed); to something like xmlLoad.load("myfeed.xml");
October 9th 2007 03: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 11: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
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 03: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 10:11PM   -   John
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 06: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 04: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 06: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 09: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 02:01PM   -   gretchen
how do i insert images(scrolling logo) in between news feed?
January 14th 2008 09: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 08:01PM   -   Simon
Fixed the font issue.

Is there any way of specifying that the link opens in a _blank target? Cheers.
January 21st 2008 10:01PM   -   Simon
My titles are not clickable? How can I fix this?
January 22nd 2008 09: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 10: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 01: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 10: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 10:03PM   -   MC
My other 2 posts were mistakes. I meant this feed: http://www.blogengage.com/rss.php
March 19th 2008 10: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 05: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
May 21st 2008 07: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
Can someone share their code if the feed is from an xml file? Is that possible? I'm new to this and I love it.
July 28th 2008 12:07AM   -   irma
Hi, I'm a designer (not particularly great at code), I think your feed scroller is awesome! I've found a problem and it's been highlighted above - the scolling stops aftera reasonably short while - has anyone managed to work out why and can offer a fix?

Thankyou in advamce!

B0b
September 10th 2008 07:09AM   -   Bob
if your scrolling text stops its because it ran to the end of the text length. Just reset scrollingtext.hscroll=0 to restart the scrolling. Change the code to the below to restart the scrolling once it gets to the end of the code.

onEnterFrame=function(){
//Scroll the text
scrollingtext.hscroll=((scrollingtext.hscroll+movementspeed)%(textlength+Stage.width));
if (scrollingtext.maxhscroll == scrollingtext.hscroll){
scrollingtext.hscroll=0;
}

}
November 1st 2008 07:11PM   -   Brian
How can I define a specific font size for this ticker? I have everything else set the way I need it! thanks, Chris
November 12th 2008 04:11PM   -   Chris
which code would one alter to get this to scroll vertically?
December 23rd 2008 05:12PM   -   Roger
I entered the code above from Brian, but my scroll is still stopping. Any ideas?
January 27th 2009 03:01PM   -   Christy
Hello,

I did the same as Christy, Entered brians code ans still my scroll is stopping. Please help.
February 3rd 2009 10:02AM   -   Hilton
How can I make it show only the first item in the feed?
Also, how do I change the font?
March 8th 2009 09:03AM   -   Simon
Those of you who get the flicking "loading" box a. E.G. papy. This can be caused by using the .fla file and publishing it yourself. The source .fla has an EXTRA frame on the end, causing the movie to loop and restart 30 times a second. Just use flash to remove the second frame and the flicking loading message goes away.

Tom the oceanhippie. P.S. Great piece of work was strugging to fine someting suitable.

Tom
April 9th 2009 08:04AM   -   oceanhippie
Thanks alot for this! I am currently a student and I don't know much about XML or RSS feeds yet but I think this will give me a good step in the right direction!

RoyMan
May 7th 2009 02:05PM   -   RoyMan
Does anybody know how to use this rss reader with JSON instead of XML?
May 20th 2009 09:05AM   -   Roger
does anybody know how to make the rss feed stop on rollover? I am new to actionscript
May 23rd 2009 06:05PM   -   mark
Great work John, and thanks Brian for the code to restart the scrolling after it stops, works well.

Thanks
June 14th 2009 12:06PM   -   C64
Hi

thanx for the lovely script it has helped me but I would require to run the rss directly in the flash file as i am creating a screen saver which runs the rss feed can U help me
June 16th 2009 05:06AM   -   Nehal
To Everyone Looking to "customize" this feed: for the n00bs out there you need to get rid of some of the generic code at the top i.e. lines 5-14 these create the "text area". Leave the property that creates the loading text. Now - go out to your stage and drag out a text box. make sure you give it the following properties: dynamic text, render text as html and single line, and give it an instance name of "scrollingtext" after that you do that...have at it. Change color size background text etc. that should answer about half the questions on this forum
August 26th 2009 03:08PM   -   Word2theWhys
Thanx for the script i was looking for it from long time :)
September 2nd 2009 10:09AM   -   Marshal
thanks
November 6th 2009 09:11AM   -   vigrx
im trying to use this script to make a news ticker for a plasma screen, when it restarts its a little jumpy so i wanted to hide it for a few seconds then show it again, this is how i changed the end of the code

function wait() {
if (scroller._visible==false)
{scroller._visible=true
trace("The time is now !!");

}
}

onEnterFrame=function(){
scroller.hscroll=((scroller.hscroll+movementspeed)%(textlength+Stage.width));
if (scroller.maxhscroll == scroller.hscroll){
scroller._visible=false
myTimer = setInterval(wait, 5000)
scroller.hscroll=0
}
}


it runs the wait once but it wont run it again...any ideas as im really stuck here and i know its going to just be something silly that im just over looking.
November 27th 2009 06:11AM   -   heed
Really nice post,thanks for sharing....
November 28th 2009 03:11AM   -   Free online games
I have bookmarked your site. Thanks for sharing
December 13th 2009 08:12AM   -   dental
nice works really like it.

www.sms2life.com
December 15th 2009 03:12AM   -   sms2life
Thanks a lots
December 15th 2009 03:12AM   -   sms2life
Hi,

i tried making the changes you suggested, but to no avail

do i have to configure any security settings perhaps?
January 1st 2010 09:01PM   -   Cialis
thanks
January 14th 2010 09:01AM   -   ses &#305;&#351;&
I managed to get this to work without using html file.

Firstly I assigned the _root.feed to an xml file like so;
//XML File name
_root.feed = "somefilename.xml";

I also created a dynamic textfield and named it scrollingtext. Then I changed this line;
this.createTextField("scrollingtext", this.getNextHighestDepth(), 0, 0, Stage.width, Stage.height);
To;
this.scrollingtext;

That is all and it works like magic. And oh it is easy to change the text colours and other text formating issues can be addressed directly without any action script.

Good luck guys.
January 20th 2010 05:01PM   -   Sakayaya
The scroller is nice but I really don't have a use for it at the moment.
January 20th 2010 09:01PM   -   EDI Services
clear code. biikmark it.
January 21st 2010 01:01PM   -   wallpapers scroller
it.
January 24th 2010 07:01AM   -   evening dresses
RSS feed scroller
January 24th 2010 09:01AM   -   Ares 2
Special thank for good post.
February 5th 2010 09:02PM   -   à¹‚หลดเพลงà
Thank for the information
February 6th 2010 07:02AM   -   à¹‚หลดเพลงm
Thank for the information
February 6th 2010 07:02AM   -   à¹‚หลดเพลงm
Special thank for good post.
February 10th 2010 04:02AM   -   à¹‚หลดเพลงà
Add a Comment
name:
website (optional):
captcha type the characters into the box
message (5000 characters or less):