发布到墙 - 使用Actionscript的流错误

时间:2011-09-08 05:29:48

标签: actionscript-3 api facebook-graph-api

使用Actionscript API,我收到以下IOError

[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://graph.facebook.com/********/feed"]

我使用以下代码:

package  
{
import flash.display.Sprite;
import com.facebook.graph.Facebook;
import flash.system.Security;

public class Test extends Sprite
{

    public function Test() 
    {
        Security.allowDomain("*.facebook.com");
        Security.allowDomain("profile.ak.fbcdn.net");
        Security.allowDomain("static.ak.fbcdn.net");
        Security.allowDomain("graph.facebook.com");

        Security.allowInsecureDomain("*");

        Security.loadPolicyFile("http://graph.facebook.com/crossdomain.xml");

        Facebook.init("************", initHandler);

        var permissions:Array = ['publish_stream'];
        Facebook.login( loginHandler, { perms:permissions.join(',') } );
    }

    private function loginHandler(success:Object,fail:Object):void 
    { 
        trace("loginHandler success ="+success);
        trace("loginHandler fail    ="+fail);

        if(success)
        { 
            Facebook.api('/me/', handleMeLoad);
        } 
        else
        { 
            trace("unable to connect to Facebook");
        }
    }

    private function handleMeLoad(response:Object, fail:Object):void 
    {
        if (response) 
        {
            trace("response.first_name = "+response.first_name);
            trace("response.last_name = "+response.last_name);
            trace("response.id "+response.id);

            var values:Object = {
                                message:"MESSAGE"
                                };

            Facebook.api('/'+response.id+'/feed', handlePostComplete, values, "POST");
        }
    }

    private function initHandler(success:Object,fail:Object):void 
    {
        trace("initHandler response = "+success);
        trace("initHandler fail = "+fail);
    }

    private function handlePostComplete(response:Object, fail:Object)
    {
        trace("handlePostToFriendsWallComplete response "+response);
        trace("handlePostToFriendsWallComplete fail "+fail);
    }
}

}

(所有fb vars为Strings)

使用Flash player 10.

2 个答案:

答案 0 :(得分:0)

facebook.init这行不正确。 虽然FB API的Actionscript实现的文档很可怕,但您可以从J(s)DK获得一些指示。

http://developers.facebook.com/docs/reference/oldjavascript/FB.Facebook.init/

答案 1 :(得分:0)

结果Facebook将我的IP /帐户列入黑名单。他们至少可以告诉我......非常无益