Facebook Actionscript 和 IE

发布于 2024-11-02 02:10:08 字数 8154 浏览 1 评论 0原文

我正在尝试使用 Facebook Actionscript 图形 api,但我似乎在 IE 中遇到问题(到目前为止,chrome 和 firefox 等其他浏览器似乎没问题)。

据我所知,它登录正常并返回用户 ID,但是当我使用 Facebook.api(_user, handleUserRequest); 对该用户进行查找时我收到一个错误。

Facebook Actionscript 图形 API 是否存在仅影响 IE 的已知问题?

谢谢 ob

每个请求 - 错误如下:

[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://graph.facebook.com/100002210990429?access%5Ftoken=205690086123032%7C2%2EUzvN3mFr07kPAecZ7qN1Rg%5F%5F%2E3600%2E1303135200%2E1%2D100002210990429%7Cz9L%5Fc26QKCc6cs2g5FClG%5FBsoZg"]

如果将此 url 粘贴到 chrome 中,则效果很好,但 IE

最好 返回“无法从 graph.facebook.com 下载 XXXXXXXXX” 我正在使用的代码

如下:

package com.client.facebookgame.services 
{

    import com.client.facebookgame.services.events.FacebookServiceEvent;
    import com.facebook.graph.data.FacebookSession;
    import com.facebook.graph.Facebook;
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.TimerEvent;
    import flash.external.ExternalInterface;
    import flash.net.URLRequestMethod;
    import flash.utils.Timer;
    import uk.co.thereceptacle.utils.Debug;

    /**
     * Facebook Service
     */
    public class FacebookService extends EventDispatcher
    {
        // constants
        public static const API_KEY             : String = "XXXXXX";
        public static const PERMISSIONS         : String = "read_stream,publish_stream,user_likes";
        public static const FB_REDIRECT_URL     : String = "http://apps.facebook.com/appname/";
        public static const LOGGED_IN           : String = "loggedin";
        public static const LOGGED_IN_ON_FB     : String = "loggedinonfacebook";
        public static const LOGGED_OUT          : String = "loggedout";
        public static const LOGGED_OUT_ON_FB    : String = "loggedoutonfacebook";

        public static const TIMEOUT_COUNT       : int = 10;
        public static const TIMER_DELAY         : int = 3 * 1000;


        // properties
        private var _user           : String;
        private var _topUrl         : String;
        private var _currentState   : String;
        private var _timer          : Timer;
        private var _timerCount     : int;

        public var postObject       : Object;


        // constuctor
        public function FacebookService() 
        {
            if (ExternalInterface.available) _topUrl = ExternalInterface.call("top.location.toString");
            Debug.log("facebook init", this);
            Facebook.init(API_KEY, handleLogin);

            startTiming();

            currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
        }




        // methods
        public function login():void
        {
            Facebook.login(handleLogin, { perms: PERMISSIONS } );
        }

        public function logout():void
        {
            Facebook.logout(handleLogout);
        }

        public function selectUserFriendsWithAppRequestDialogue(message:String, dialogueType:String = "iframe", optionalPostObject:Object = null):void
        {
            this.postObject = optionalPostObject;
            Facebook.ui("apprequests", { message:message }, handleAppRequest, dialogueType);
        }

        public function checkIfUserLikesApp():void
        {
            Facebook.api(_user + "/likes", handleLikes);
        }

        private function startTiming():void
        {
            if (_timer) clearTimer();
            _timer = new Timer(TIMER_DELAY, TIMEOUT_COUNT);
            _timer.addEventListener(TimerEvent.TIMER, handleTimerEvents);
            _timer.addEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
            _timer.start();
        }

        private function clearTimer():void
        {
            _timer.stop();
            _timer.removeEventListener(TimerEvent.TIMER, handleTimerEvents);
            _timer.removeEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
            _timer = null;

            _timerCount = 0;
        }

        // event handlers
        private function handleLogin(success:Object, fail:Object):void
        {
            if (_timer) clearTimer();

            if (success)
            {
                Debug.log(success, this);
                _user = success.uid;

                currentState = _topUrl ? LOGGED_IN : LOGGED_IN_ON_FB;

                Facebook.api("/" + _user, handleGetUser);
            }
            else if (!success && !_topUrl)
            {
                ExternalInterface.call("redirect", API_KEY, PERMISSIONS, FB_REDIRECT_URL);
            }
        }

        private function handleGetUser(success:Object, fail:Object):void
        {
            Debug.log(success + ", " + fail, this);
            if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_COMPLETE, success));
            else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL, fail, true));
        }

        private function handleAppRequest(result:Object):void
        {
            if (postObject)
            {
                for (var i:int = 0; i < result.request_ids.length; i++)
                {
                    var requestID:String = result.request_ids[i];
                    Facebook.api("/" + requestID, handleRequestFriends); 
                }
            }
        }

        private function handleRequestFriends(success:Object, fail:Object):void
        {
            if (success)
            {
                var friendID:String = success.to.id;
                Facebook.api("/" + friendID + "/feed", handleSubmitFeed, postObject, URLRequestMethod.POST);
            }
            else
            {
                Debug.log(fail, this);
            }
        }

        private function handleLikes(success:Object, fail:Object):void
        {
            if (success)
            {
                for (var i:int = 0; i < success.length; i++)
                {

                    Debug.log("compare " + success[i].id  + " with key: " + API_KEY, this);
                    if (success[i].id == API_KEY)
                    {

                        Debug.log("found that user liked this app!!!", this, true);
                        dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:true } ));
                        return;
                    }
                }

                dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:false } ));
            }
            else
            {
                Debug.log(fail, this, true);
            }
        }

        private function handleLogout(obj:*):void
        {
            currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
        }

        private function handleSubmitFeed(success:Object, fail:Object):void
        {
            if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_SUBMITTED, success));
            else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_FAIL, fail, true));
        }

        private function handleTimerEvents(e:TimerEvent):void 
        {
            switch (e.type)
            {
                case TimerEvent.TIMER :
                    _timerCount ++;
                    Debug.log("facebook init attempt " + _timerCount, this);
                    Facebook.init(API_KEY, handleLogin);
                    break;

                case TimerEvent.TIMER_COMPLETE :
                    clearTimer();
                    dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL));
                    break;
            }
        }



        // accessors / mutators
        public function get currentState():String { return _currentState; }
        public function set currentState(value:String):void
        {
            if (_currentState != value)
            {
                _currentState = value;
                dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.STATE_UPDATE));
            }
        }

    }

}

非常感谢 观察

I'm trying to use the Facebook Actionscript graph api but I seem to be having problems in IE (other browsers like chrome and firefox seem okay so far).

From what i can tell, it's logging in fine and returning the user id but when i do a lookup on that user with Facebook.api(_user, handleUserRequest); I get an error.

Is there any known problems with the Facebook Actionscript graph api that affects IE only?

thanks
ob

Per request - the error is as follows:

[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://graph.facebook.com/100002210990429?access%5Ftoken=205690086123032%7C2%2EUzvN3mFr07kPAecZ7qN1Rg%5F%5F%2E3600%2E1303135200%2E1%2D100002210990429%7Cz9L%5Fc26QKCc6cs2g5FClG%5FBsoZg"]

This if this url is pasted into chrome it works just fine, but IE returns 'unable to download XXXXXXXX from graph.facebook.com'

best
obie

the code that I'm using is as follows:

package com.client.facebookgame.services 
{

    import com.client.facebookgame.services.events.FacebookServiceEvent;
    import com.facebook.graph.data.FacebookSession;
    import com.facebook.graph.Facebook;
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.TimerEvent;
    import flash.external.ExternalInterface;
    import flash.net.URLRequestMethod;
    import flash.utils.Timer;
    import uk.co.thereceptacle.utils.Debug;

    /**
     * Facebook Service
     */
    public class FacebookService extends EventDispatcher
    {
        // constants
        public static const API_KEY             : String = "XXXXXX";
        public static const PERMISSIONS         : String = "read_stream,publish_stream,user_likes";
        public static const FB_REDIRECT_URL     : String = "http://apps.facebook.com/appname/";
        public static const LOGGED_IN           : String = "loggedin";
        public static const LOGGED_IN_ON_FB     : String = "loggedinonfacebook";
        public static const LOGGED_OUT          : String = "loggedout";
        public static const LOGGED_OUT_ON_FB    : String = "loggedoutonfacebook";

        public static const TIMEOUT_COUNT       : int = 10;
        public static const TIMER_DELAY         : int = 3 * 1000;


        // properties
        private var _user           : String;
        private var _topUrl         : String;
        private var _currentState   : String;
        private var _timer          : Timer;
        private var _timerCount     : int;

        public var postObject       : Object;


        // constuctor
        public function FacebookService() 
        {
            if (ExternalInterface.available) _topUrl = ExternalInterface.call("top.location.toString");
            Debug.log("facebook init", this);
            Facebook.init(API_KEY, handleLogin);

            startTiming();

            currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
        }




        // methods
        public function login():void
        {
            Facebook.login(handleLogin, { perms: PERMISSIONS } );
        }

        public function logout():void
        {
            Facebook.logout(handleLogout);
        }

        public function selectUserFriendsWithAppRequestDialogue(message:String, dialogueType:String = "iframe", optionalPostObject:Object = null):void
        {
            this.postObject = optionalPostObject;
            Facebook.ui("apprequests", { message:message }, handleAppRequest, dialogueType);
        }

        public function checkIfUserLikesApp():void
        {
            Facebook.api(_user + "/likes", handleLikes);
        }

        private function startTiming():void
        {
            if (_timer) clearTimer();
            _timer = new Timer(TIMER_DELAY, TIMEOUT_COUNT);
            _timer.addEventListener(TimerEvent.TIMER, handleTimerEvents);
            _timer.addEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
            _timer.start();
        }

        private function clearTimer():void
        {
            _timer.stop();
            _timer.removeEventListener(TimerEvent.TIMER, handleTimerEvents);
            _timer.removeEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
            _timer = null;

            _timerCount = 0;
        }

        // event handlers
        private function handleLogin(success:Object, fail:Object):void
        {
            if (_timer) clearTimer();

            if (success)
            {
                Debug.log(success, this);
                _user = success.uid;

                currentState = _topUrl ? LOGGED_IN : LOGGED_IN_ON_FB;

                Facebook.api("/" + _user, handleGetUser);
            }
            else if (!success && !_topUrl)
            {
                ExternalInterface.call("redirect", API_KEY, PERMISSIONS, FB_REDIRECT_URL);
            }
        }

        private function handleGetUser(success:Object, fail:Object):void
        {
            Debug.log(success + ", " + fail, this);
            if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_COMPLETE, success));
            else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL, fail, true));
        }

        private function handleAppRequest(result:Object):void
        {
            if (postObject)
            {
                for (var i:int = 0; i < result.request_ids.length; i++)
                {
                    var requestID:String = result.request_ids[i];
                    Facebook.api("/" + requestID, handleRequestFriends); 
                }
            }
        }

        private function handleRequestFriends(success:Object, fail:Object):void
        {
            if (success)
            {
                var friendID:String = success.to.id;
                Facebook.api("/" + friendID + "/feed", handleSubmitFeed, postObject, URLRequestMethod.POST);
            }
            else
            {
                Debug.log(fail, this);
            }
        }

        private function handleLikes(success:Object, fail:Object):void
        {
            if (success)
            {
                for (var i:int = 0; i < success.length; i++)
                {

                    Debug.log("compare " + success[i].id  + " with key: " + API_KEY, this);
                    if (success[i].id == API_KEY)
                    {

                        Debug.log("found that user liked this app!!!", this, true);
                        dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:true } ));
                        return;
                    }
                }

                dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:false } ));
            }
            else
            {
                Debug.log(fail, this, true);
            }
        }

        private function handleLogout(obj:*):void
        {
            currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
        }

        private function handleSubmitFeed(success:Object, fail:Object):void
        {
            if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_SUBMITTED, success));
            else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_FAIL, fail, true));
        }

        private function handleTimerEvents(e:TimerEvent):void 
        {
            switch (e.type)
            {
                case TimerEvent.TIMER :
                    _timerCount ++;
                    Debug.log("facebook init attempt " + _timerCount, this);
                    Facebook.init(API_KEY, handleLogin);
                    break;

                case TimerEvent.TIMER_COMPLETE :
                    clearTimer();
                    dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL));
                    break;
            }
        }



        // accessors / mutators
        public function get currentState():String { return _currentState; }
        public function set currentState(value:String):void
        {
            if (_currentState != value)
            {
                _currentState = value;
                dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.STATE_UPDATE));
            }
        }

    }

}

Thanks very much
ob

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感情旳空白 2024-11-09 02:10:08

我在 facebook actionscript 问题列表中找到了答案:
http://code.google.com/p/facebook -actionscript-api/issues/detail?id=197

我也在寻找解决方案
但唯一的方法就是发布它
Flash播放器10

为我解决了这个问题

i found the answer on the facebook actionscript issues list:
http://code.google.com/p/facebook-actionscript-api/issues/detail?id=197

I was also trying to find a solution
but the only one is to publish it with
flash player 10

fixed the problem for me

眉黛浅 2024-11-09 02:10:08

我遇到了同样的问题。此问题的主要原因是 Flash Player 版本。
使用 Flash Player 10+ FaceBookGraphApi SWC 文件与 Flash Player 10 兼容。
此解决方案仅适用于使用 GraphAPI_Examples_1_6_1 中的 SWC 的人

I was facing same issue.Main reason of this issue is Flash Player version.
Use Flash Player 10+ FaceBookGraphApi SWC file is compatible with Flash Player 10.
This solution is only for who are using swc from GraphAPI_Examples_1_6_1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文