Skip to content

Instantly share code, notes, and snippets.

@netoleal
Created November 28, 2011 21:01
Show Gist options
  • Save netoleal/1402036 to your computer and use it in GitHub Desktop.
Save netoleal/1402036 to your computer and use it in GitHub Desktop.
Exemplo FacebookApplication
package
{
import com.netoleal.facebook.app.FacebookApplication;
import com.netoleal.facebook.model.FacebookFriendModel;
public class FacebookApplicationExample
{
private var fb:FacebookApplication;
public function FacebookApplicationExample( )
{
init( );
}
public function init( ):void
{
fb = new FacebookApplication( "_app_id_here_" );
fb.init( ).queue( onFacebookInit );
}
private function onFacebookInit( success:Boolean ):void
{
trace( success );
if( !success )
{
fb.loginUser( ).queue( onLogin );
}
else
{
onLogin( true );
}
}
private function onLogin( success:Boolean ):void
{
trace( fb.user );
fb.user.loadFriends( ).queue( onLoadFriends );
}
private function onLoadFriends( ):void
{
trace( fb.user.friends.length );
var firstFriend:FacebookFriendModel = fb.user.friends[ 0 ];
firstFriend.user.load( ).queue( onFriendUserLoad, firstFriend );
}
private function onFriendUserLoad( friend:FacebookFriendModel, success:Boolean ):void
{
trace( friend.user.fullName );
}
public function dispose():void
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment