0

I am setting up a facebook app - with the AS3 facebook API. The first thing i do is call Facebook.init(). When this is done on our normal development setup (a normal http site) - this works perfectly and i am able to access the graph. However when i switch to a https site (with a self signed certificate) Facebook.init() never fires the callback. I have crossdomain.xml set up correctly to allow all and security false. Anybody know how i could set this up so that it will work.

fideldonson
  • 581
  • 3
  • 15
  • I advice to use ExternalInterface to call Facebook API. You just need simple gate script in JS that will call, receive and send responses from FB to swf. Advantage of that solution is that JS don't have so much safety restrictions as AS3 and you have better caching support from browser. – Konrad Apr 22 '13 at 10:19

2 Answers2

0

Indeed the Facebook connection with the FB API AS3 doesn't work anymore since august...

With the FlashWebExemple.fla from http://code.google.com/p/facebook-actionscript-api/downloads/detail?name=GraphAPI_Examples_1_8_1.zip

        Facebook.init(APP_ID, onInit);

        protected function onInit(result:Object, fail:Object):void {
            trace("on INIT");
            if (result) { //already logged in because of existing session
                outputTxt.text = "onInit, Logged In\n";
                loginToggleBtn.label = "Log Out";
            } else {
                outputTxt.text = "onInit, Not Logged In\n";
            }
        }

No "on INIT" message...

Anyone ?

Benoît Freslon
  • 2,021
  • 4
  • 26
  • 35
  • In as3 don't use 'if(result)' if you want to test Object. Any change in API (e.g. change Object from Boolean to {status: true, code: 200}) will make you code useless and you wont even notice it. – Konrad Apr 22 '13 at 10:09
0

Get accessToken from FB.init in JS

Pass accessToken to Flash (swf params or ExternalInterface)

Call Facebook.init() with accessToken and set options.status = true

var options:Object = {};
var accessToken:String = null;
if(!StringValidator._isNullOrEmpty(m_swfParameters._accessToken))
{
    options.status = true;
    accessToken = m_swfParameters._accessToken;
}

Facebook.init(m_facebookProvider._appId, _onInitedCallback, options, accessToken);

if(options.status === true)
{
    _onInitedCallback(options, null);
}
mizi_sk
  • 1,007
  • 7
  • 33