在Flash应用程序中获取我的个人资料图片时出现问题


Issues getting my profile picture in a Flash application

我有一个PHP脚本,它使用以下内容返回我(和我的朋友)的个人资料图片:

http://graph.facebook.com/".$ID."/picture?type=large其中$ID是使用PHP API检索的ID。然后我使用以下方法在我的应用程序中加载图像:

public function LoadProfile()
{
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onUrlLoaded);
    loader.load(new URLRequest(ImageURL));
    //ImageURL is the URL provided by the PHP Script
    // which is the 'http://graph.facebook.com/XXXX/picture?type=large'
}
private function onUrlLoaded(event:Event)
{           
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onUrlLoaded);
    var path:String = LoaderInfo(event.target).url;
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onReallyComplete);
    var lc:LoaderContext = new LoaderContext(true);
    lc.checkPolicyFile = true;
    loader.load(new URLRequest(path), lc);
}
private function onReallyComplete(event:Event)
{
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onReallyComplete);
}  

这对我所有的朋友都有效,但由于某种原因对我不起作用。我得到以下我的朋友的图片的一般地址:

http://profile.ak.fbcdn.net/hprofile-ak-snc4/370825_524761447_653077984_n.jpg

但对我来说,我只是得到

http://profile.ak.fbcdn.net

这是一个随机的人。。。不是我。。。

我已经反复验证了从PHP发回的ID实际上是我的ID,我已经将加载功能之前跟踪的地址复制/粘贴到浏览器中,我得到了正确的个人资料图片,但在那里的某个地方,它在加载中检测到了我的ID而只有我的ID(我应该重新表述它,说无论用户登录Facebook,而不仅仅是我,它都会出错)。

有什么想法吗?或者有人知道另一种获取我个人资料照片的方法吗?

public function loadProfile():void
{
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_completeHandler);
    loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loader_securityErrorHandler);
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loader_ioErrorHandler);
    loader.load(new URLRequest(_imageURL));
}
private function loader_securityErrorHandler(event:SecurityErrorEvent):void
{
    trace(event.toString());
}
private function loader_ioErrorHandler(event:IOErrorEvent):void
{
    trace(event.toString());
}
private function loader_completeHandler(event:Event):void
{
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loader_completeHandler);
    loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loader_securityErrorHandler);
    loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, loader_ioErrorHandler);
    addChild(loader);
}