Developers > Learning Center > Facebook Dynamic Library Tutorial
This tutorial will demonstrate how to use the dynamically extensible Facebook library. The primary advantage to using this library dynamically is that your widget's filesize will only increase where necessary (i.e. you might only need the library when the widget is on facebook)
- Adobe Flash CS3/CS4 (or Flex)
- wAPI .mxp (If you don't have this installed yet, follow the steps found here)
We will be creating a new widget and extending it with the ActionScript 3.0 Client Library for Facebook Platform. It is recommended that you download this library and look over the code.
We will set up a widget as usual, adding a few lines to pull in the library.
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event)
{
widget.initWidget(300,250,0x000000);
//add a listener for when the library is loaded
widget.addEventListener(widget.LIBRARIES_LOADED, onLibrariesLoaded);
//tell the widget to load the facebook library,
widget.requireLibrary("facebook","*");
}
function onLibrariesLoaded(evt:Event):void{
//in this function widget.libraries.facebook will be accessible
}
Go to the dashboard, click add new widget, and follow the prompts.
The resulting code should look like this:
Congratulations! You successfully added a dynamic facebook library to your widget and can now access Facebook from all over the world wide web.
Start sharing your social widgets!
yourminis