我在使用以下代码时遇到问题:
this.fb_init();
}
private function fb_init():void {
Facebook.init("xxxxxxxxxxxxxxx",fb_handleInit);
}
private function fb_handleInit(success:Object,fail:Object):void {
if (success && success.uid) {
fb_loggedIn(success);
}else{
show_FacebookLoginButton();
}
}
private function show_FacebookLoginButton():void {
....
}
private function handleMouseDown_FacebookLoginButton(event:MouseEvent):void {
_stage.removeChild(_fb_login_button);
this.fb_login();
}
private function fb_login():void {
Facebook.login(fb_handleLogin,{scope:"user_games_activity,friends_games_activity"});
}
private function fb_handleLogin(success:Object=null,fail:Object=null):void {
if (success) {
fb_loggedIn(success);
}else{
show_FacebookLoginButton();
}
}
private function fb_loggedIn(response:Object) {
trace("success!);
}
首先,在 fb_handleInit(success:Object,fail:Object) 中,成功和失败都始终为空。
其次,在登录后(或者如果已经登录则立即),fb_handleLogin(success:Object=null,fail:Object=null) 永远不会被调用,并且 flash 会输出以下错误:
ReferenceError: Error #1069: Property expiresIn not found on String and there is no default value.
at com.facebook.graph.data::FacebookAuthResponse/fromJSON()
at com.facebook.graph::Facebook/handleAuthResponseChange()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at flash.external::ExternalInterface$/_callIn()
at Function/<anonymous>()
Firebug 显示此错误消息:未捕获的异常:Actionscript 中的错误。使用 try/catch 块来查找错误。xd_arbiter.php 第 13 行 (http://static.ak.facebook.com/connect/xd_arbiter.php)
Chrome 显示此错误消息:未捕获的错误:在 NPObject 上调用方法时出错。
I've been googling and reading about it for a few days, and I've posted an issue at http://code.google.com/p/facebook-actionscript-api/ with no response so far. I'm surprised the the lack of examples that I can find. I've found a few and tried them and still had problems.