Actionscript 3 AS3,Facebook API-Can';加载映像后,无法从事件对象检索映像

Actionscript 3 AS3,Facebook API-Can';加载映像后,无法从事件对象检索映像,actionscript-3,facebook-graph-api,Actionscript 3,Facebook Graph Api,当我试图将登录Facebook用户好友列表中的个人资料图像加载到as3 canvas应用程序时,我得到了一个神秘的结果。在我制作的几乎每一个(非facebook)应用程序中,如果需要加载图像,我都会使用以下方法: private function loadPic():void { var url:String = Facebook.getImageUrl(_friendslistObjectArray[_loadCount].id); _picLoader = new Loade

当我试图将登录Facebook用户好友列表中的个人资料图像加载到as3 canvas应用程序时,我得到了一个神秘的结果。在我制作的几乎每一个(非facebook)应用程序中,如果需要加载图像,我都会使用以下方法:

private function loadPic():void
{
    var url:String = Facebook.getImageUrl(_friendslistObjectArray[_loadCount].id);
    _picLoader = new Loader();
    var req:URLRequest = new URLRequest(url);
    _picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPicLoaded);

    _picLoader.load(req);
}

private function onPicLoaded(evt:Event):void
{
    _picLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onPicLoaded);

    // grab image from loader event to use it       
    var image = evt.target.content;

    trace("this trace won't even show up and the program silently fails unless the line above this is removed");

    _loadCount++;
    loadPic();
}
我无法从事件对象检索图像,并且我没有收到任何错误。这一切都只是默默地失败了。如果我删除行var image=evt.target.content,该过程将贯穿整个数组

我想不出会发生这种情况的任何原因。此外,如果我查看firebug的网络活动,我会看到图像被加载,只要我没有包含我刚才提到的行。我似乎无法从事件对象获取图像数据以将其添加到stage或容器movieclip

这应该很容易。我绞尽脑汁想弄清楚我错过了什么或是什么错了。有什么想法吗?谢谢

找到了答案:

这一行:

Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");
放置在\u picLoader.load(需要)的正前方修复了该问题

这是一个跨域错误,但由于某种未知原因,直到我抛出var image=evt.target.content,错误才报告进入try/catch并读取错误消息

这篇文章的道具可以找到答案:
evt.target应该是
LoaderInfo
对象,请在此处尝试代码:

var image = (evt.targe as LoaderInfo).loader.content;