在 Flash Builder 中加载来自 Facebook 的图像

发布于 2024-10-20 21:37:22 字数 661 浏览 2 评论 0原文

我正在做一个 Facebook 应用程序,我想从用户的相册中提取所有可能的图像。

我现在想做的是一个 fql 查询,这样我就可以找到属于该特定用户的所有图像。它是这样的:

        protected function loadFromFacebook(event:MouseEvent):void {

            var fql:String = "select src_small from photo where owner = me()";              
            Facebook.fqlQuery(fql, handleGetPhotosResponse);

        }


        private function handleGetPhotosResponse(event:Object, fail:Object):void {
            if (event != null){

                facebookPhotos = new ArrayCollection(event as Array);

            } 
        }

我将这些图像存储在数组集合中,但我不知道之后如何继续。如何将这些图像加载到平铺列表或加载器中?

任何帮助将不胜感激,

谢谢

I'm doing a Facebook App where I'd like to pull out all the possible images from a user's album.

What I'm trying to do at the moment is a fql query so that i can find all the images that belong to that specific user. it goes something like that:

        protected function loadFromFacebook(event:MouseEvent):void {

            var fql:String = "select src_small from photo where owner = me()";              
            Facebook.fqlQuery(fql, handleGetPhotosResponse);

        }


        private function handleGetPhotosResponse(event:Object, fail:Object):void {
            if (event != null){

                facebookPhotos = new ArrayCollection(event as Array);

            } 
        }

I store this images in an array collection but I don't know how to proceed after that. How can I load those images into, say, a Tile List or a Loader?

Any help would be much appreciated,

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┊风居住的梦幻卍 2024-10-27 21:37:22

假设您是一个名为“tList”的 TileList 组件,您将在 arraycollection 上执行“for 循环”并创建一个新图像,并在每次迭代时将其添加到 TileList。

// I am not sure if the array collection contains photo urls, 
// but this is the general idea ...
// you may need to build the url with fb graph ...
for ( var i:uing = 0; i < facebookPhotos.length; i++ ) 
{
    var img:Image = new Image();
    img.load( facebookPhotos.getItemAt(i) ); // url here
    tList.addChild( img );
}

Assuming you are a TileList component named 'tList', you would do a 'for loop' on the arraycollection and create a new image, and add it to the TileList on each iteration.

// I am not sure if the array collection contains photo urls, 
// but this is the general idea ...
// you may need to build the url with fb graph ...
for ( var i:uing = 0; i < facebookPhotos.length; i++ ) 
{
    var img:Image = new Image();
    img.load( facebookPhotos.getItemAt(i) ); // url here
    tList.addChild( img );
}
捶死心动 2024-10-27 21:37:22

您应该执行一个接收结果对象和失败对象的处理程序函数。
结果对象是您通过 fql 请求的字段数组。

    protected function loadFromFacebook(event:MouseEvent):void {

        var fql:String = "select src_small from photo where owner = me()";              
        Facebook.fqlQuery(fql, handleGetPhotosResponse);

    }

    protected function handleGetPhotosResponse(result:Object, fail:Object):void
        {
            photosList = new ArrayCollection();
            var photo:Object;
            for (var i:Object in result)
            {
                photo = new Object();
                photo.imgSrc = result[i].src_small;
                photosList.addItem(photo);
            }
            provider = photosList;
        }

you should do a handler function that receive a result object and a fail object.
the result object is an array of fields that you requested with the fql.

    protected function loadFromFacebook(event:MouseEvent):void {

        var fql:String = "select src_small from photo where owner = me()";              
        Facebook.fqlQuery(fql, handleGetPhotosResponse);

    }

    protected function handleGetPhotosResponse(result:Object, fail:Object):void
        {
            photosList = new ArrayCollection();
            var photo:Object;
            for (var i:Object in result)
            {
                photo = new Object();
                photo.imgSrc = result[i].src_small;
                photosList.addItem(photo);
            }
            provider = photosList;
        }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文