//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');
}
Adobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. Flex applications can be written using Adobe Flex Builder or by using the freely available Flex compiler from Adobe.
Showing posts with label url. Show all posts
Showing posts with label url. Show all posts
Friday, June 24, 2011
Flex Share on facebook
/**
* Flex Share on facebook - quick & easy way
**/
public function ShareOnFacebook(shareUrl:String):void
{
var openUrl:String = "http://www.facebook.com/sharer.php?u="+shareUrl;
navigateToURL(new URLRequest(openUrl), '_blank');
}
* Flex Share on facebook - quick & easy way
**/
public function ShareOnFacebook(shareUrl:String):void
{
var openUrl:String = "http://www.facebook.com/sharer.php?u="+shareUrl;
navigateToURL(new URLRequest(openUrl), '_blank');
}
Subscribe to:
Posts (Atom)
Freelance
Find more freelance jobs