0

在 Flash 中,我在构建后首先调用身份验证,如何避免弹出窗口阻止程序。

public function FacebookProxy(appID:String, permissions:Object) {
        this.appID = appID;
        this.permissions = permissions;
    }

    public function authenticate():void { 
        var response:FacebookAuthResponse = Facebook.getAuthResponse();
        if(response && response.uid) {
            this.success(response);
        } else {
            this.init();
        }
    }

    protected function init():void { 
        Security.loadPolicyFile("https://fbcdn-profile-a.akamaihd.net/crossdomain.xml");
        Facebook.init(this.appID, this.initHandler);
    }

    protected function initHandler(response:FacebookAuthResponse, fail:Object):void {
        if(response && response.uid){ 
            this.success(response);
        } else { 
            setTimeout(this.login, 200);
        }
    }

    protected function login():void {
        Facebook.login(loginHandler, this.permissions);
    }

    protected function loginHandler(response:FacebookAuthResponse, fail:Object):void {
        if(response && response.uid) {
            this.success(response);
        } else {
            //ExternalInterface.call("trace", "code:" + fail.error.code + ", message:" + fail.error.message + ", type:" + fail.error.type);
        }
    }

    protected function success(response:FacebookAuthResponse):void {
    }
4

2 回答 2

0

我不知道 flash,但你不能Facebook.init, Facebook.login自动调用,它会被弹出窗口拦截器捕获。

仅在用户活动上触发这两种方法,即点击用户。

于 2012-05-19T07:43:36.667 回答
0

据我记得,登录Facebook最顺畅的方式(通过游戏应用程序,没有流行,只有一个权限屏幕)是使用js api登录并将详细信息传递到flash

于 2012-05-20T18:15:07.853 回答