FYI

The problem is that in the facebook air sdk there is a constant: 

public static var LOGIN_SUCCESS_URL:String 
      = 'http://www.facebook.com/connect/login_success.html'; ...

and in MobileLoginWindow of the sdk: 

protected function handleLocationChange(event:Event):void 
                { 
                        var location:String = webView.location; 
                        if
(location.indexOf(FacebookURLDefaults.LOGIN_FAIL_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_FAIL_SECUREURL) == 0) 
                        { 
                                webView.removeEventListener(Event.COMPLETE,
handleLocationChange); 
                               
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange); 
                                loginCallback(null,
FacebookDataUtils.getURLVariables(location).error_reason); 
                                userClosedWindow =  false; 
                                webView.dispose(); 
                                webView=null; 
                        } 

                        else if
(location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_SECUREURL) == 0) 
                        { 
                                webView.removeEventListener(Event.COMPLETE,
handleLocationChange); 
                               
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange); 
                               
loginCallback(FacebookDataUtils.getURLVariables(location), null); 
                                
                                userClosedWindow =  false; 
                                webView.dispose(); 
                                webView=null; 
                        } 
                } 

As facebook is now sending
"http://m.facebook.com/connect/login_success.html"; 

this is not working anymore... So it has nothing to do with the Flex or Air
SDKs... 


To fix it:

1. download the source of the api...
2. add to FacebookURLDefaults.as

public static var LOGIN_URL_MOBILE:String
                   = 'http://m.facebook.com/connect/login_success.html';

   public static var LOGIN_SECUREURL_MOBILE:String
                   = 'https://m.facebook.com/connect/login_success.html';

3. change MobileLoginWindow.as

protected function handleLocationChange(event:Event):void
                {
                        var location:String = webView.location;
                        if 
(location.indexOf(FacebookURLDefaults.LOGIN_FAIL_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_FAIL_SECUREURL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_URL_MOBILE) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SECUREURL_MOBILE) == 0)
                        {
                                webView.removeEventListener(Event.COMPLETE, 
handleLocationChange);
                                
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange);
                                loginCallback(null,
FacebookDataUtils.getURLVariables(location).error_reason);
                                userClosedWindow =  false;
                                webView.dispose();
                                webView=null;
                        }

                        else if 
(location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_SECUREURL) == 0  || 
location.indexOf(FacebookURLDefaults.LOGIN_SECUREURL_MOBILE) == 0 || 
location.indexOf(FacebookURLDefaults.LOGIN_URL_MOBILE) == 0)
                        {
                                webView.removeEventListener(Event.COMPLETE, 
handleLocationChange);
                                
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange);
                                
loginCallback(FacebookDataUtils.getURLVariables(location), null);
                                
                                userClosedWindow =  false;
                                webView.dispose();
                                webView=null;
                        }
                }

4. Build SWC and replace the old one

Christian



--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-facebook-actionscript-api-broken-Facebooks-October-2013-Breaking-Changes-tp2921p2941.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to