Flex3: How Do I Add a Twitter Share Button?
I've got a Flex 3 website. How do I add开发者_StackOverflow社区 a Twitter share button?
Thank you.
-Laxmidi
Just use a regular Flex Button that links to twitter. Conceptually something like this:
<mx:Button id="TwitterButton" click="onClick()" />
The onClick method should just create a new URLRequest and the navigate to it.
<mx:script>
public function onClick():void{
var urlRequest = new URLRquest('/http://twitter.com/share?url=http://bit.ly/fKYLIN&text=I just got a free Flex AutoComplete Component courtesy of @Flextras It rocks! Be sure to get your own');
navigateToURL(urlRequest);
}
</mx:script>
The twitter URL format should be documented somewhere in the twitter help. Start here and then go here.
You should factually use the Twitter AS3 API. Sharing on twitter is just a function call away, if you use that API. You can get the details here
- http://www.republicofcode.com/tutorials/flash/twitter_widget/
- http://johannesluderschmidt.de/lang/en-us/twitter-as3-library-twitterscript-flex-example/564/
- http://code.google.com/p/tweetr/
I found this tutorial, which shows how to do it: link
精彩评论