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

Preface

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 authorized 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.

What this book covers

Chapter 1, Getting Started with Flash and Facebook: This chapter deals with downloading the Facebook ActionScript 3 SDK, registering a new Application on Facebook.com, getting your Flash Builder development environment set up, and getting ready to start working with the Facebook APIs.

Chapter 2, Authenticating with Facebook: Our application can't do much unless it's first authenticated with Facebook, so this chapter covers logging in, logging out, and tapping into existing Facebook sessions, for both Flash Player and AIR-based projects.

Chapter 3, Working with Facebook Permissions: Even authenticated, our application can't do much without the correct permissions, so this chapter covers processes, tactics, and strategies for working with and requesting those Extended Permissions for Facebook users.

Chapter 4, Reading and Writing Data with the Graph API: A generalized introduction to working with the core Graph API, including retrieving specific objects, multiple objects, and object connections; searching for data, limiting and paging results; and an introduction to creating and managing data with the Graph API.

Chapter 5, Loading Data with FQL: FQL is the SQL-like syntax for retrieving data from Facebook, and with it we can retrieve far more specific data than we can with the Graph API, including data that is unavailable via the Graph API.

Chapter 6, Facebook News Feeds and Status Updates: In this chapter, we look at loading Facebook News and Profile Feeds, creating new Status updates and Links, and adding custom actions to links to help promote your Facebook application.

Chapter 7, Comments and "Like this": Following on from the previous chapter, we look at loading, creating, and deleting Comments for Graph API objects, and the same for 'Likes', with both Graph API objects and web URLs.

Chapter 8, Working with Photos, Albums, and Tags: In this chapter, we'll load Photos from the Graph API—both photos of the current user, and photos from the current user. We display these images and overlay Facebook tagging information, and use the Flash Player to upload new images on the user's behalf.

Chapter 9, Working with Groups and Events: In this chapter, we retrieve Facebook Group and Event information, locate them on a Map, create new Events, and respond to Event invitations on the user's behalf.

Chapter 10, Checkins with Facebook Places: In this chapter, we download and integrate the Google Maps components and use them to plot Checkins and Facebook Places. We work with the Geolocation capabilities of HTML5, and use them to search for nearby Facebook Places and create new Checkins.

Chapter 11, Bridging the Flash and Application Gap: Finally, we'll look to improve the integration between your application and Facebook—imitate the Facebook.com website interface, use native dialogs to bypass the need for Extended Permissions, and develop a new class to simplify the authentication and permissions management for our application.

What you need for this book

  • Software:

    • Adobe Flash Builder 4 (or greater), with the Flex 4 SDK and AIR libraries

    • A web browser (obviously)

  • Additional hardware/software:

    • (Access to) an HTTP web server, either online or local

Who this book is for

This cookbook is targeted towards those with at least a basic understanding of the Flash Builder IDE and the Flex framework. No prior knowledge of the Facebook APIs is assumed or required. If you want to start building Flash Facebook apps quickly and effectively this is the book for you.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Our user interface should include two Button components—login_btn and logout_btn."

A block of code is set as follows:

function tryRequest():void
{
var data:Object = new Object();
data.message = "Hello world!";
Facebook.postData("/me/feed", onPostStatusCallback, data);
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<s:Button buttonMode="true"
click="requestThePermissions()"
enabled="false" height="32" id="request_btn"
label="Request Permissions" width="100%" />

Any command-line input or output is written as follows:

SELECT x
FROM page
WHERE page_id = 19292868552

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We should update the user interface to initially disable the Request Permissions and Post status message buttons".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.