Actionscript 3 AdobeFacebookAPI调用/“我/图片”;失败
我在Flash/AS3应用程序中使用,由于某种原因,调用Actionscript 3 AdobeFacebookAPI调用/“我/图片”;失败,actionscript-3,facebook,Actionscript 3,Facebook,我在Flash/AS3应用程序中使用,由于某种原因,调用/me/picture似乎失败,而调用/me/friends似乎工作正常: 这很好用: Facebook.api('/me/friends', onFriendsLoaded ); protected function onFriendsLoaded( response:Object, fail:Object ) : void { // I can get the friends from the response object }
/me/picture
似乎失败,而调用/me/friends
似乎工作正常:
这很好用:
Facebook.api('/me/friends', onFriendsLoaded );
protected function onFriendsLoaded( response:Object, fail:Object ) : void
{
// I can get the friends from the response object
}
这失败了:
Facebook.api('/me/picture', onPictureLoaded );
protected function onPictureLoaded( response:Object, fail:Object ) : void
{
// Here response is null and fail is ÿØÿà
}
这两种方法我都在后面调用。有什么问题吗?调用/me/picture实际上根本不是api调用。是照片的url。实际上,您可以将图像设置为该url。我不是Flash方面的专家,但如果您使用html进行此操作,您将执行以下操作:
<img src="http://graph.facebook.com/facebook_id/picture" />
这将向用户显示图片。此外,如果您想下载图片的字节,您只需发出一个普通的web请求。响应流将是图像文件。试试这种方法
function onPictureLoaded(response:Object,fail:Object):void{
if (fail)
{
trace("Error");
}
var friends = response as Array;
var l:int = friends.length;
for (var i:int=0; i < l; i++)
{
trace("http://graph.facebook.com/" + friends[i].id + "/picture/")
}
}
函数onPictureLoaded(响应:对象,失败:对象):无效{
如果(失败)
{
跟踪(“错误”);
}
var friends=响应为数组;
var l:int=friends.length;
对于(变量i:int=0;i