开发者

get album cover photos with facebook-actionscript-api

开发者 https://www.devze.com 2023-02-25 17:23 出处:网络
I\'m searching since a while for a solution for this problem: With the facebook-actionscript-api i\'m trying to get all the cover photos. If 开发者_如何学Goyou\'re call the photo albums like this, is

I'm searching since a while for a solution for this problem:

With the facebook-actionscript-api i'm trying to get all the cover photos. If 开发者_如何学Goyou're call the photo albums like this, is there a possibility to get the url of the cover photo too?

Facebook.api("/me/albums", getAlbumHandler);
protected function getAlbumHandler(success:Object, fail:Object):void
        {
            for (var i:int = 0; i < success.length; i++ ) 
            {
            var vo:MyVO=new MyVO(success[i].name,"<<call to get cover_photo url>>",success[i].id);
            myFacebookAlbums.addItemAt(vo,0);
            }
        }

Everything else is working fine but I just can't get the album cover. Or do i have to use the FQL? Isn't it possible to use something like success[i].picture because in the fb docs for album properties there is a connection to that property.

Thanks for any advice.


Using the facebook-actionscript-api, you can get the cover photos urls for all your albums like this:

Request:

Facebook.api('/me/albums', handlePhotoAlbumsResponse);

CallBack:

public var photoAlbums:Array=new Array();

private function handlePhotoAlbumsResponse(albums:Object, fail:Object):void
{
        if (albums != null)
        { 
            var a:Array = new Array();
            a = albums as Array;
            for (var i:int = 0; i < a.length; i++)
            {
                var vo:AlbumVO = new AlbumVO();
                vo.id = a[i].id;
                vo.name = a[i].name;
                vo.coverPhoto = a[i].cover_photo;
                photoAlbums.push(vo);
            }
        }
}

where AlbumVO is a simple getter/setter value object with a String property called coverPhoto to hold the cover photo url.

0

精彩评论

暂无评论...
验证码 换一张
取 消