Created
November 28, 2011 21:01
-
-
Save netoleal/1402036 to your computer and use it in GitHub Desktop.
Exemplo FacebookApplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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