Developers > FLEX Learning Center > Social API Tutorial
This tutorial will demonstrate how to use the yourminis Social Widget API to take advantage of social features within Facebook and OpenSocial supported websites.
- Completed the RSS Flex Widget Tutorial
- Download the source code for this example here: Samples.
We will be extending the widget we developed in the RSS Flex Widget Tutorial with social capabilites.
This is the function where we handle the clicking of the RSS item within the Repeater. Currently, this handler navigates the user to the URL and tracks the URL click within the yourminis widget reporting server.
private function onClick(url:String):void
{
widget.navigateToURL(new URLRequest(url));
}
There are two classes that delegate social-related functions within the yourminis API:
yourminis.api.social.SimpleSocial
yourminis.api.social.Facebook
All wAPI widgets will have a widget.social
instance of type yourminis.api.social.ISocial
automatically set before the widget.WIDGET_LOADED event within the top level DisplayObject.
In the code below, we will utilize the Facebook API if the widget is running in Facebook, otherwise we will use the OpenSocial API.
Go to the dashboard, click add new widget, and follow the prompts.
The resulting code should look like this:
In order to test the Social APIs, you will need to have the widget loaded within either Facebook or an OpenSocial site that supports creating new activities. To test on Facebook, your widget needs to be associated to a Facebook application using the instructions in the Dashboard -> Syndication -> Galleries section of your widget.
On facebook, this is what it would look like in the mini-feed after clicking links in this widget:

Congratulations! You successfully added social capabilities to your flex widget and can begin to take advantage of the distribution that social networks have to offer.
Start sharing your social widgets!
yourminis