2011-03-08 16 views
1

私はFacebookのAppを使って、ユーザーのアルバムから可能なすべての画像を取り出したいと思っています。Flash Builderで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); 

      } 
     } 

私はこのイメージをアレイコレクションに保存しますが、それ以降の処理方法はわかりません。どのようにしてこれらのイメージをタイルリストやローダにロードできますか?あなたと仮定すると、すべてのヘルプははるかに高く評価されるだろう

おかげ

答えて

0

はあなたのArrayCollectionに「forループ」を実行して、新しいイメージを作成し、追加することになり、「TListの」という名前のTileListコンポーネントですそれは各繰り返しで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); 
} 
0

結果オブジェクトと失敗オブジェクトを受け取るハンドラ関数を実行する必要があります。 結果オブジェクトは、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; 
     } 
関連する問題