Solved

XML feed from Twitter

Posted on 2009-06-29
3
2,794 Views
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???

Cheers


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:
			loadTwitterXML("http://twitter.com/statuses/user_timeline/19526069.xml");
			
		
		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);
			
			trace("LOADED");
			
			// Populate the xml object with the xml data:
			twitterXML = new XML(e.target.data);
			showTwitterStatus();
		}
		
		function showTwitterStatus():void
		{
			trace(twitterXML);
			
			// 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

0
Comment
Question by:Sideas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Jones911 earned 500 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.

http://apiwiki.twitter.com/Libraries#ActionScript/Flash
0
 
LVL 19

Expert Comment

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

Expert Comment

by:ccarey
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:

http://mydomain.com/proxy.cfm?url=http://yourdomain.com/file.xml
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
Suggested Courses

734 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