ActionScript 3 AS3:使用SWX访问Twitter用户的公共时间线

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3:使用SWX访问Twitter用户的公共时间线相关的知识,希望对你有一定的参考价值。

package
{
	import flash.display.Sprite;
	
	import org.swxformat.SWX;
	
	public class main extends Sprite
	{
		//http://apiwiki.twitter.com/SWX+Twitter+API
		public static const SWX_PUBLIC_GATEWAY:String = "http://www.swxformat.org/php/swx.php";
		
		private var currentImage:Number = 0;
		private var maxImages:Number = 10;
		private var swx:SWX;
		
		public function main()
		{
			swx = new SWX()
			swx.gateway = SWX_PUBLIC_GATEWAY;
			swx.encoding = "GET";
			
			var twitterRequest:Object = { 
				serviceClass: "Twitter", 
				method: "userTimeline",
				timeout: 5,
				//debug: true,
				resultHandler: resultHandler,
				progressHandler: progressHandler,
				timeoutHandler: timeoutHandler,
				faultHandler: faultHandler,
				//[ "user", "password", "userId", "limit", "since"]
				args: [ "chrisaiv", "******", "", "10" ]
			};
			
			swx.call( twitterRequest );
		}
		
		private function progressHandler( e:Object ):void
		{
			//trace( "progressHandler: " + e.bytesLoaded / e.bytesTotal );
		}
		
		private function timeoutHandler( e:Object ):void
		{
			trace( "timeoutHandler: " );
		}
		
		private function faultHandler( e:Object ):void
		{
			trace( "faultHandler: " + e );
		}
		
		private function resultHandler( e:Object ):void
		{
			//Twitter
			var data:Array = e.result as Array;
			for( var i:Number = 0; i < data.length; i++ ){
				var info:Object = data[i] as Object;
				trace( "Published: ", info.created_at, "Text:", info.text, "Avatar:", info.user.profile_image_url, "User:", info.user.screen_name );				
			}
		}
	}
}

以上是关于ActionScript 3 AS3:使用SWX访问Twitter用户的公共时间线的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3:使用SWFObject2和AS3传递变量

如何在服务器端生成SWX数据文件?

ActionScript 3 使用AS3绘制一个矩形

ActionScript 3 AS3:在ActionScript中使用E4X生成动态XML

ActionScript 3 使用Blitting的AS3动画

ActionScript 3 AS3:使用POST发送数据