4 Replies Latest reply on Dec 16, 2010 4:24 PM by TheOriginalEdge

    can't parse embedded arrays in Facebook JSON

    TheOriginalEdge Level 1

      If this is not the correct forum for questions about using Flex 4 to write a Facebook application please direct me to a better one!





      The friendslist logic (below ) works because the data coming back from that call is entirely encapsulated in an array named "data".  The photos logic fails because result is not just an array, it has a second member (called "paging") at the top level after the "data" array of tagged photos.   result.data returns null, instead of the expected (embedded) array.  How can this embedded array be accessed?


            calls that invoke the handlers:

                  Facebook.api("/me/photos", photosHandler);

                  Facebook.api("/me/friends", friendsHandler);



                  protected function photosHandler(result:Object, fail:Object):void {

                          var obj:Object = result.data;
                          var aList:ArrayList = new ArrayList(obj as Array);
                          photoListCollection = new ArrayCollection();
                          photosList.dataProvider = photoListCollection;



              private var photoListCollection:ArrayCollection = new ArrayCollection();
              private var list:ArrayCollection = new ArrayCollection();


              protected function friendsHandler(result:Object, fail:Object):void {
                          var aList:ArrayList = new ArrayList(result as Array);
                          list = new ArrayCollection();
                          friendsList.dataProvider = list;