1

graphapi_web_1_8_1.swc has a Facebook.init() function that takes pretty much the same arguments as the FB.init() JavaScript version. However, what I'm interested in setting is Facebook's hideFlashCallback parameter, via the "options" argument passed into both Facebook.init() and FB.init(). The JavaScript SDK takes a value of type "Object" as shown here:

http://developers.facebook.com/docs/reference/javascript/FB.init/

However, if I'm already calling graphapi_web_1_8_1.swc's Facebook.init() from ActionScript, how can I pass in a JavaScript function as the hideFlashCallback?

I tried using ExternalInterface.call() to call a "GetHideFlashCallback()" JS function whose return value was the callback function as an object, but it comes back as null in ActionScript, even when the ActionScript variable was typed as "Object" or "*".

My next test is to avoid calling graphapi_web_1_8_1.swc's Facebook.init() and just do something like ExternalInterface.call("FB_init_proxy(args)") which would just use Facebook's JavaScript SDK directly.

But is there a way to pass JavaScript functions back and forth with ActionScript as Object variables? If not, why? Is it a security concern?

4

1 回答 1

0

您可以在此处查看问题的原因:https ://developers.facebook.com/blog/post/637/

所以在 facebook 的 javascript init 中你必须添加 hideFlashCallback:

FB.init({
    appId:appId,
    status:true,
    cookie:true,
    oauth:true,
    frictionlessRequests: true,
    hideFlashCallback : displayFlash
});

在 displayFlash 功能中你可以做你想做的事

function displayFlash( a )
{
    if( a.state == 'opened' )
    {
        // do what you want when a chat or notification is open
    }
    else
    {
        // do what you want when a chat or notification is closed
    }
}
于 2014-03-09T15:59:12.470 回答