Clicky

I have a flash application that is working great accept for displaying facebook albums, but there is a limit of 25 photos using the default settings.  I've researched and it seems that you have to set the paging to a higher number and perhaps set the offset.  I'm just not sure how to pass those values to facebook using ActionScript.  Any help would be GREATLY appreciated.  I'm including the code below:
 import com.facebook.graph.Facebook; import com.facebook.graph.controls.*; import com.facebook.graph.core.*; import com.facebook.graph.data.*; import com.facebook.graph.net.*; import com.facebook.graph.utils.*; import flash.events.MouseEvent; import com.adobe.serialization.json.*; import flash.display.MovieClip;  var APP_ID:String = "248877778485757"; var SECRET_KEY:String = "b87cc3d878f524da6f813e61748c075a";  var albums:Array; var aImages:Array; aImages = new Array(); var aAlbumsButton:Array;  //Initialize Facebook library Facebook.init(APP_ID, onInit);                      function onInit(result:Object, fail:Object):void  {                             login_mc.login_btn.buttonMode = true;     login_mc.login_btn.addEventListener(MouseEvent.CLICK, onLoginClick); }  // function onLoginClick(e:MouseEvent):void {     root.makeFacebookScreen();          if (Facebook.getSession() && Facebook.getSession().accessToken==null)     {        // t.text = "LOGGED OUT";        var opts:Object = {perms:"publish_stream, user_photos"};         Facebook.login(onFacebookLogin, opts);     }     else     {       //  t.text = "LOGGED IN";       Facebook.logout(onFacebookLogout);     } }  // function onFacebookLogout(success:Boolean):void  {                 var opts:Object = {perms:"publish_stream, user_photos"};     Facebook.login(onFacebookLogin, opts); }  // function onFacebookLogin(result:Object, fail:Object):void  {     if (result)      {          loggedIn();     }      else      {                          } }  // function loggedIn():void {     //Facebook.api('/me/albums', onMyInfoLoaded);     //Facebook.api('/235523383144855/photos', onMyInfoLoaded); }  // function makeAlbums():void {     Facebook.api('/me/albums', onMyAlbumsLoaded);          removeChild(login_mc);     }  // function onMyAlbumsLoaded(result:Object,fail:Object):void  {     albums = result as Array;     aAlbumsButton = new Array();          for (var i:int = 0; i < albums.length; i++)      {         var album:MovieClip = new FacebookAlbumButton();         album.albumName = albums[i].name;         album.albumID = albums[i].id;         album.numPhotos = albums[i].count;         album.id = i;         album.y = 57 + i * album.height;         addChild(album);         aAlbumsButton[i] = album;     }          //load first album     loadPhotos(0); }  function loadPhotos(_id:Number):void {     removePhotos();          for each(var a in aAlbumsButton )     {         a.isClicked = false;         a.hover_mc.alpha = 0;     }          aAlbumsButton[_id].isClicked = true;     aAlbumsButton[_id].hover_mc.alpha = 1;          Facebook.api('/' +  albums[_id].id + '/photos', onMyPhotosLoaded); }  /*login_mc.x = 1000; onMyPhotosLoaded(null, null);*/ // function onMyPhotosLoaded(result:Object,fail:Object):void  {     photos = result as Array;     var xSpacing:int = 0;     var ySpacing:int = 0;     var rows:Number = 0;     var cols:Number = 0;          for (var i:int = 0; i < photos.length; i++)      {         var photo:MovieClip = new FacebookThumb();         photo.x = cols * photo.width + xSpacing;         photo.y = rows * photo.height + ySpacing;         photo.id = i;         photo.thumbPath = photos[i].images[2].source;         photo.photoPath = photos[i].source;         aImages[i] = photo;         images_mc.addChild(photo);          cols ++;         xSpacing += 15;                  //if( cols >= 5 )         //{             //cols = 0;             //xSpacing = 0;             //rows ++;             //ySpacing += 15;         //}     }          holder_cmp.source = images_mc;     holder_cmp.verticalScrollPosition = 0;     holder_cmp.horizontalScrollPosition = 0;       }  function removePhotos():void {     for each(var p in aImages )         p.removeObject();              aImages = []; }                             
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 

Select allOpen in new window

asked 11/27/2011 01:13

raganpro's gravatar image

raganpro ♦♦


1 Answers:
Okay, I finally figured this out.  I'm posting the solution here for anyone else that has the same problem:  Facebook uses URL's to send GET requests.  You can pass a simple URL variable to increase the default number of photos returned from a given album.  

Change this:
1:
Facebook.api('/' +  albums[_id].id + '/photos', onMyPhotosLoaded);

To this:
1:
Facebook.api('/' +  albums[_id].id + '/photos&limit=500', onMyPhotosLoaded);


It's all remarkably simple once you figure it out.  In any case, I hope this helps someone else down the road.
link

answered

raganpro's gravatar image

raganpro

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×1

Asked: 11/27/2011 01:13

Seen: 353 times

Last updated: 11/28/2011 12:12