2011-03-08 7 views
1

나는 사용자 앨범에서 가능한 모든 이미지를 가져오고 싶은 페이스 북 앱을 만들고 있습니다.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에 '루프'할 새로운 이미지를 생성하고 추가 할 것 '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; 
     }