Demo | Download

 

note: this wont work for protected accounts, it’ll require authentication.

neat yeah? 🙂 buggy though, you may download the source code and improve it anyway you could!

in a nutshell, Im using PHP to receive data from flash & send it over to twitter via an API call and then send back the received XML to flash,

twitter.as

package {
	import flash.display.*;
	import flash.events.*;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.system.Security;
    import flash.net.URLVariables;
	import flash.net.*;

	public class Twitter extends MovieClip {
		private var cont:MovieClip;
		public var speed:Number=-6;
		private var menu:Array = new Array();
		//Security.allowDomain("twitter.com");

		public function Twitter():void {
			//create a new container ( a movieclip )
			cont = new MovieClip();
			// set its x and y
			cont.x=stage.stageWidth*0.5;
			cont.y=(stage.stageHeight*0.5);
			// add it to the stage
			addChild(cont);
			//attach an event listener
			addEventListener(Event.ENTER_FRAME, render);
			//attach an event listener to the "go" button
			go.addEventListener(MouseEvent.CLICK,loadTweets)
		}

		private function loadTweets(E:Event):void{
			loading_mc.alpha = 1;
			//PHP path or full path
			var url:String = "proxy.php";
			//Grab the twitter handle
			var tweetHandle:String = handle.text;
			//declare variables
			var myVars:URLVariables = new URLVariables();
			//assign variables
			myVars.user = tweetHandle;
			//create a new request
			var Request:URLRequest = new URLRequest();
			//assign request url
			Request.url = url;
			//define the methiod ( GET or POST )
			Request.method = URLRequestMethod.POST;
			//attach the variables to the request
			Request.data = myVars;
			//create a kiader for the request
			var tweetXmlLoader:URLLoader = new URLLoader();
			//define the data format
			tweetXmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
			// attach an event listener
			tweetXmlLoader.addEventListener(Event.COMPLETE, generateTweets);
			//time for action!
			tweetXmlLoader.load(Request);
			//remove unwanted library items and ditach unused events listeners
			go.enabled = false;
			go.removeEventListener(MouseEvent.CLICK, loadTweets);
			removeChild(go);
			removeChild(handle);

		}

		public function generateTweets(e:Event):void {
			//remove "loading tweets" movieclip from stage
			removeChild(loading_mc);
			//define an XMLList and assign the new received data to it
			 var tweetXML:XMLList = new XMLList(e.target.data );
				// loop em BABY!
				 for (var i:uint=0; i<10; i++) {
				//grab a tweetbox from the library ( runtime loading ) see export for more info.
				 var t:MovieClip = new tweetBox();
				 //assign the status ( tweet ) to the text within the tweetBox
				 t.txtBox.text = tweetXML.status[i].text
				 //just to check
				 trace (tweetXML.status[i].text);
                 // assign a z prop ( focal length ) how close/far is each box
				 t.z=3000-(i*400);
				 // add it to the container we created earlier
				 cont.addChild(t);
				//push the movieclip to use it on the Event.ENTER_FRAME function ( render )
				 menu.push(t);
			 }

		}

		function render(e:Event):void {
			// loop through menu
			for(var j:int=menu.length-1;j>=0;j--) {
				//increase the z prop!
				menu[j].z+=speed;

				// if item in menu Z prop is greater less than 600 then take it back to 3400
				if (menu[j].z<-600){
					menu[j].z=3400;
				}
			}
		}
	}
}

Now for the PHP part … you may also consider using the php function “readfile” instead if cURL, I just felt like testing it!

<?php

$url = $_POST['user'];

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https:\/\/zainals.com//zainals.com\/\/zainals.com//zainals.com//api.twitter.com/1/statuses/user_timeline.xml?screen_name='.$url);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
{
    print "Sorry, Moe is a sicko!.<p>";
}
else
{
    print $buffer;
}
?>