Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love the structure of the site. You start at the top, and drill down to what you want. Maybe I've been using Unix too long... :-) "

Geography

Where in the world do Tek-Tips members come from?

How to display more than 25 images from a facebook album?

wraygun (Programmer)
28 Nov 11 0:07
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:

CODE

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 = [];
}

Thanks,
Wray

***You can't change your past, but you can change your future***

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close