Revision: 49325
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 20, 2011 01:28 by adrianparr
Initial Code
package { import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.net.navigateToURL; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLLoaderDataFormat; public class Main extends Sprite { private var tinyLoader:URLLoader public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); stage.addEventListener(MouseEvent.CLICK, postToTwitter); tinyLoader = new URLLoader(); tinyLoader.dataFormat = URLLoaderDataFormat.TEXT; tinyLoader.addEventListener(Event.COMPLETE, gotTinyURL); } private function postToTwitter(event:MouseEvent):void { trace("postToTwitter()"); tinyLoader.load(new URLRequest('http://tinyurl.com/api-create.php?url=http://www.adrianparr.com')); } private function gotTinyURL(event:Event):void { trace(tinyLoader.data); var reqString:String = 'http://twitter.com/home?status=Check this out ' + encodeURIComponent(tinyLoader.data); navigateToURL(new URLRequest(reqString), "_blank"); } } }
Initial URL
http://www.nayansavla.com/blog/?p=253
Initial Description
Initial Title
AS3 Post tinyurl to Twitter via Twitter webpage
Initial Tags
post, twitter
Initial Language
ActionScript 3