views:

109

answers:

3

hi.

I'm new to facebook development, after testing the adobe api in a flash game I decided to test using the graph api communicating with my flash game. After doing basic stuff like connecting and getting my user's data, i was wondering if it's posible to get my user's friends profile pcitures, so i can pass them to UILoaders inside my flash game and show them.

If anyone can point me to examples of basic actions which use the facebook graph api, like invite friends or posting to the wall for example, that would be wonderful.

thanks.

update:

Using Nathan's suggestion I tried to get my friends and it worked:

$friends= $facebook->api('/me/friends?token='.$session['access_token']);
var_dump($friends);

Then I tried to get my friend's pictures with:

foreach ($friends['data'] as $friend)
    {
        $picture= $facebook->api('/'.$friend['id'].'/photo');
    }

But it didn't work. any idea ?

Thanks.

+2  A: 

You first have to get the list of friends https://graph.facebook.com/me/friends?access_token=... then for each of the friends you can request http://graph.facebook.com/user_id/photo That will give you the url of their current profile photo.

Nathan Totten
I had success getting my friends, but nothing with my friend's pictures. I updated the question to see if you could find the problem.
José Joel.
The problem is that getting the photo isnt an api call. The graph url actually will just redirect you to the url. I dont know much about flash, but if I wanted to use the photo of a user for example, I would do this: <img src="http://graph.facebook.com/user_id/photo" /> So rather than making the $facebook->$api call just bind your photo to the url.
Nathan Totten
Did you get this solved? If so, please consider marking my answer as the correct answer.
Nathan Totten
+1  A: 

There are a lot of libraries out there that can make facebook development significantly easier. Here's a recent release:

Big Spaceships Facebook Library

Hope this resource helps!

TheoryNine
Thanks !, gonna check it now.
José Joel.
A: 

Another library (sorry I had to split it out because I'm a "new member"):

Facebook Actionscript API

TheoryNine