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
About the Author
About the Reviewers
Checkins and Facebook Places

Sorting FQL results

FQL results can be sorted before they're returned, by making use of the ORDER BY query, just like you would do in a SQL request. Results can be sorted alphanumerically ascending or descending, and both normal data fields and advanced data fields can be used in the sort process.

In this recipe we're going to create an FQL request for the current user's friends, which will also apply a sort to the data prior to returning it to our application.

Getting ready

Our starting FQL request should look like this:

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

How to do it...

To apply sorting to the results of our request, we need to add the ORDER BY statement to our requests, specifying one of the table's columns as the target, and whether the sort should be ascending (ASC) or descending (DESC).

To retrieve the list of the current user's friends, and then sort the results based on the name of the user, we would use the following FQL query: