This library simplifies the creation and acquisition of data from the Facebook Graph API, as well as the expectation of returned data in a consistent and strongly-typed format. This includes, but not limited to, retrieving and posting on users’ wall feeds, creating and retrieving events and event statuses, posting comments, searching content and much more!
It does not provide login authentication as there are many other libraries available for this purpose and really…why re-invent the wheel? Some great examples are from Big Spaceship and Jozef Chúťka.
There is some functionality that has not yet been implemented (places, inbox, send email, etc) but our intent is to include them as soon as possible. If you are interested in contributing, please do so with our repository on Github!
Syntax
Once you have acquired your access_token from Facebook, you can call any one of the services provided by the API. Keep in mind that you may need to have already prompted the user with specific permissions during the authentication step in order for methods to return data properly. See more on Facebook extended permissions.
Almost every method that you can call with these services, dispatches a Signal upon completion or failure. For full documentation and more information on the signals dispatched, please visit our ASDoc
Executing a service is as simple as the following:
var service : FacebookUserService = new FacebookUserService();
service.getNewsFeed( access_token );
Listening for the response is just as easy, especially if you are familiar with Signals. Add a listener to the signal and create your responder method. Each method is documented in our ASDocs with the provided parameter reteurned.
service.newsFeedLoaded.addOnce( onNewsFeedLoaded );
function onNewsFeedLoaded( vo : FacebookFeedCollectionData ):void
{
}
Examples
Post on current logged in users’ wall
var post : FacebookFeedCreatePostData = new FacebookFeedCreatePostData( msg, link, icon );
var service : FacebookUserService = new FacebookUserService();
service.wallPostCreated.addOnce( onWallPostCreated );
service.createWallPost( access_token, FacebookConstants.CONNECTION_ME, post );
function onWallPostCreated( post_id : String ):void
{
}
Get wall post comments
var service : FacebookCommentService = new FacebookCommentService();
service.commentsLoaded.addOnce( onCommentsLoad );
service.getComments( access_token, post_id );
function onCommentsLoad( vo : FacebookCommentCollectionData ) : void
{
}
Upload a photo
var source : ByteArray = jpg.encode( bmd );
var photo : FacebookPhotoCreateData = new FacebookPhotoCreateData(
"Photo caption", source );
var service : FacebookPhotoService = new FacebookPhotoService();
service.photoCreated.addOnce( onPhotoCreated );
service.createPhoto( access_token, photo, FacebookConstants.CONNECTION_ME );
function onPhotoCreated( id : String ):void
{
}
Check out our blog post as well as our Github and ADDocs:
Facebook Graph API library for ActionScript 3
The company I work for just released an open-source ActionScript 3 library for the Facebook Graph APIs!
This library simplifies the creation and acquisition of data from the Facebook Graph API, as well as the expectation of returned data in a consistent and strongly-typed format. This includes, but not limited to, retrieving and posting on users’ wall feeds, creating and retrieving events and event statuses, posting comments, searching content and much more!
It does not provide login authentication as there are many other libraries available for this purpose and really…why re-invent the wheel? Some great examples are from Big Spaceship and Jozef Chúťka.
There is some functionality that has not yet been implemented (places, inbox, send email, etc) but our intent is to include them as soon as possible. If you are interested in contributing, please do so with our repository on Github!
Syntax
Once you have acquired your
access_tokenfrom Facebook, you can call any one of the services provided by the API. Keep in mind that you may need to have already prompted the user with specific permissions during the authentication step in order for methods to return data properly. See more on Facebook extended permissions.Almost every method that you can call with these services, dispatches a Signal upon completion or failure. For full documentation and more information on the signals dispatched, please visit our ASDoc
Executing a service is as simple as the following:
Listening for the response is just as easy, especially if you are familiar with Signals. Add a listener to the signal and create your responder method. Each method is documented in our ASDocs with the provided parameter reteurned.
service.newsFeedLoaded.addOnce( onNewsFeedLoaded ); function onNewsFeedLoaded( vo : FacebookFeedCollectionData ):void { }Examples
Post on current logged in users’ wall
var post : FacebookFeedCreatePostData = new FacebookFeedCreatePostData( msg, link, icon ); var service : FacebookUserService = new FacebookUserService(); service.wallPostCreated.addOnce( onWallPostCreated ); service.createWallPost( access_token, FacebookConstants.CONNECTION_ME, post ); function onWallPostCreated( post_id : String ):void { }Get wall post comments
var service : FacebookCommentService = new FacebookCommentService(); service.commentsLoaded.addOnce( onCommentsLoad ); service.getComments( access_token, post_id ); function onCommentsLoad( vo : FacebookCommentCollectionData ) : void { }Upload a photo
var source : ByteArray = jpg.encode( bmd ); var photo : FacebookPhotoCreateData = new FacebookPhotoCreateData( "Photo caption", source ); var service : FacebookPhotoService = new FacebookPhotoService(); service.photoCreated.addOnce( onPhotoCreated ); service.createPhoto( access_token, photo, FacebookConstants.CONNECTION_ME ); function onPhotoCreated( id : String ):void { }Check out our blog post as well as our Github and ADDocs:
Dareville library for Facebook Graph APIs
Github library
ASDocs