Revision: 32359
Updated Code
at September 23, 2010 00:58 by Whiteagle
Updated Code
//Twitter/Bit.Ly Share Imports import flash.net.navigateToURL; import mx.rpc.events.ResultEvent; import mx.rpc.xml.SimpleXMLDecoder; import mx.utils.ObjectUtil; //Twitter/Bit.Ly Share Vars private var bitLyLoader:URLLoader; /* * Call this function to share on twitter, passing your url trough bit.ly! */ private function twitterShare(articleUrl:String):void { // Insert your bit.ly account name & API Key bellow var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl="+articleUrl+"&format=xml"; var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl); bitLyLoader = new URLLoader(bitLyApi); bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished); } /* * Get the short link & post to twitter */ private function bitLyFinished(event:Event):void { // Lets decode the bit.ly answer! var getLink:XMLDocument = new XMLDocument(bitLyLoader.data); var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true); var bitLyLink:Object = decoder.decodeXML(getLink); // Insert your message bellow! Use %23 for trending topics! (Example: %23DigitalWorks) var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" %23DigitalWorks"; navigateToURL(new URLRequest(URL), '_blank'); }
Revision: 32358
Updated Code
at September 23, 2010 00:57 by Whiteagle
Updated Code
//Twitter/Bit.Ly Share Imports import flash.net.navigateToURL; import mx.rpc.events.ResultEvent; import mx.rpc.xml.SimpleXMLDecoder; import mx.utils.ObjectUtil; //Twitter/Bit.Ly Share Vars private var bitLyLoader:URLLoader; /* * Call this function to share on twitter, passing your url trough bit.ly! */ private function twitter_clickHandler(articleUrl:String):void { // Insert your bit.ly account name & API Key bellow var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl="+articleUrl+"&format=xml"; var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl); bitLyLoader = new URLLoader(bitLyApi); bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished); } /* * Get the short link & post to twitter */ private function bitLyFinished(event:Event):void { // Lets decode the bit.ly answer! var getLink:XMLDocument = new XMLDocument(bitLyLoader.data); var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true); var bitLyLink:Object = decoder.decodeXML(getLink); // Insert your message bellow! Use %23 for trending topics! (Example: %23DigitalWorks) var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" %23DigitalWorks"; navigateToURL(new URLRequest(URL), '_blank'); }
Revision: 32357
Updated Code
at September 23, 2010 00:56 by Whiteagle
Updated Code
//Twitter/Bit.Ly Share Imports import flash.net.navigateToURL; import mx.rpc.events.ResultEvent; import mx.rpc.xml.SimpleXMLDecoder; import mx.utils.ObjectUtil; //Twitter/Bit.Ly Share Vars private var bitLyLoader:URLLoader; /* * Call this function to share on twitter, passing your url trough bit.ly! */ private function twitter_clickHandler(articleUrl:String):void { // Insert your bit.ly account name & API Key bellow var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl="+articleUrl+"&format=xml"; var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl); bitLyLoader = new URLLoader(bitLyApi); bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished); } /* * Get the short link & post to twitter */ private function bitLyFinished(event:Event):void { // Lets decode the bit.ly answer! var getLink:XMLDocument = new XMLDocument(bitLyLoader.data); var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true); var bitLyLink:Object = decoder.decodeXML(getLink); var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" #DigitalWorks"; navigateToURL(new URLRequest(URL), '_blank'); }
Revision: 32356
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 23, 2010 00:29 by Whiteagle
Initial Code
//Twitter/Bit.Ly Share Imports import flash.net.navigateToURL; import mx.rpc.events.ResultEvent; import mx.rpc.xml.SimpleXMLDecoder; import mx.utils.ObjectUtil; //Twitter/Bit.Ly Share Vars private var bitLyLoader:URLLoader; /* * Call this function to share on twitter, passing your url trough bit.ly! */ private function twitter_clickHandler():void { var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl=URL&format=xml"; var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl); bitLyLoader = new URLLoader(bitLyApi); bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished); } /* * Get the short link & post to twitter */ private function bitLyFinished(event:Event):void { var getLink:XMLDocument = new XMLDocument(bitLyLoader.data); var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true); var bitLyLink:Object = decoder.decodeXML(getLink); var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" #DigitalWorks"; navigateToURL(new URLRequest(URL), '_blank'); }
Initial URL
http://www.digitalwks.com/blogs/diogo-raminhos
Initial Description
Initial Title
Share on Twitter (with Bit.ly shortned link) [FLEX]
Initial Tags
twitter, Flex
Initial Language
ActionScript 3