0 Replies Latest reply on May 9, 2010 5:08 PM by jimmyoneshot

    Facebook API Login with the login window loaded in html component

    jimmyoneshot Level 1

      I am making an air app which utilises net based content such as bringing viewing their facebook photos within the app itself but I DON'T want my users to be able to browse to the internet or more specifically open up internet explorer. Problem is the facebook api requires the user to go to a facebook login page when the login for the facebook session is fired. Is there any way I can ghet this to open up in a html component rather than internet explorer? The facebooksession.login() seems to open up this window by default and doing the validatelogin without this seems to throw a null object reference error.


      Can anybody help please? Here's my code:-



      public function facebookLoginButtonClick():void{
       facebookSession = new FacebookSessionUtil("blah","blah",stage.loaderInfo);
       facebookSession.addEventListener(FacebookEvent.WAITING_FOR_LOGIN, facebookHandle_waitingForLogin);
       facebookSession.addEventListener(FacebookEvent.CONNECT, facebookHandle_connect);
      private function facebookHandle_waitingForLogin(event:FacebookEvent):void{
       var facebookAlert:Alert = Alert.show("Click OK After You've logged in to Facebook", "Logging In");
       facebookAlert.addEventListener(Event.CLOSE, facebookHandle_close); 
      private function facebookHandle_close(event:Event):void{
      private function facebookHandle_connect(event:FacebookEvent):void{
       var facebookCall:FacebookCall = facebookSession.facebook.post(new GetInfo([facebookSession.facebook.uid],['name', 'pic_square']));
       facebookCall.addEventListener(FacebookEvent.COMPLETE, facebookHandle_getInfoComplete);
      private function facebookHandle_getInfoComplete(event:FacebookEvent):void{
       var facebookGetInfoData:GetInfoData = GetInfoData(event.data);
       var facebookUser:FacebookUser = FacebookUser(facebookGetInfoData.userCollection.getItemAt(0));
       facebookUserAvatar.source = facebookUser.pic_square;
       facebookUsername.text = facebookUser.name;