XML feed from Twitter

Posted on 2009-06-29
Medium Priority
Last Modified: 2013-11-11
Hi, this works on my desktop but not online: I call Main() at any point on the tmeline so I thought  it would have enough time to parse the xml...and if not how do I???


var twitterXML:XML; // This holds the xml data
		function Main()
			var myTwitterID:Number = 19526069; 
			// Fire the loadTwitterXML method, passing it the url to your Twitter info:
		function loadTwitterXML(URL:String):void
			var urlLoader:URLLoader = new URLLoader();
			// When all the junk has been pulled in from the url, we'll fire finishedLoadingXML:
			urlLoader.addEventListener(Event.COMPLETE, finishLoadingXML);
			urlLoader.load(new URLRequest(URL));			
		function finishLoadingXML(e:Event = null):void
			// All the junk has been pulled in from the xml!  Hooray!
			// Remove the eventListener as a bit of housecleaning:
			e.target.removeEventListener(Event.COMPLETE, finishLoadingXML);
			// Populate the xml object with the xml data:
			twitterXML = new XML(e.target.data);
		function showTwitterStatus():void
			// Prep the text field to hold our latest Twitter update:
			twitter_txt.wordWrap = true;
			twitter_txt.autoSize = TextFieldAutoSize.LEFT;
			// Populate the text field with the first element in the status.text nodes:
			twitter_txt.htmlText = twitterXML.status.text[0];

Open in new window

Question by:Sideas
  • 2
LVL 19

Accepted Solution

Jones911 earned 2000 total points
ID: 24737652
It wont ever work.  Twitter have a crossdomain policy that prohibit this.

Take a look at the prebuilt API's or gather the XML via a prozy on your server.

LVL 19

Expert Comment

ID: 24737658
You can view the crossdomain.xml file here if your interested: http://www.twitter.com/crossdomain.xml

Expert Comment

ID: 24743851
You can get around this by creating your own proxy using server side code (PHP, ColdFusion etc) to retrieve the XML and supply it to you. That circumvents the whole crossdomain business.

the call looks something like this:


Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question