Book Image

Flash Facebook Cookbook

By : James Ford
Book Image

Flash Facebook Cookbook

By: James Ford

Overview of this book

Flash applications are popular and becoming increasingly social. With flash applications for facebook you can tap into a potential audience of half a billion existing users, their connections and affiliations, their uploaded images, posts, comments and more.The Flash Facebook Cookbook is packed with recipes for the Graph API and FQL, used for reading and writing data as well as interacting with Facebook anonymously or on behalf of an authorised Facebook User.The topics covered by the recipes in this Cookbook include working with News feeds, uploading Photos, searching for and plotting Places on a map and much more. The cookbook has recipes ranging from those that work without any authentication with Facebook to those that do, and act on behalf of a user. Packed with recipes that yield practical demonstrations of the Graph API functionality, the Flash Facebook Cookbook is an essential tool for Flash Platform developers.
Table of Contents (18 chapters)
Flash Facebook Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
10
Checkins and Facebook Places

Limiting and paging FQL results


Just like we can limit the number of results from a Graph Connection, we can also place a limit on the number of results from FQL requests, a practice recommended by Facebook in the Developer Documentation.

In this recipe we're going to request a small list of the user's friends, using the LIMIT capabilities of the FQL language to return only 10 results.

Getting ready

The requests in this recipe build on those explored for the earlier recipe Using subqueries in FQL. We don't require any additional Extended Permissions from Facebook, just an authenticated user.

How to do it...

Paging and limiting results from an FQL query uses much the same syntax as in SQL the LIMIT key word. It's easier to show than it is to explain so, to load the first 10 friends of the current user, we'd use the following FQL query:

SELECT uid,name
FROM user
WHERE uid
IN (
SELECT uid2
FROM friend
WHERE uid1 = me()
)
LIMIT 10

That would grab the friend results 1 through 10, but if we wanted to...