You are previewing Flash Facebook Cookbook.
O'Reilly logo
Flash Facebook Cookbook

Book Description

Over 60 recipes for integrating the Flash applications with the Graph API and Facebook.

  • Work with the key Graph API objects and their social connections, using the Facebook ActionScript 3 SDK.

  • Create new Checkins at Facebook Places and plot existing Checkins and Facebook Places on Flex mapping components.

  • Upload image files or generated images to Facebook.

  • Packed full of solutions using a recipe-based approach.

  • In Detail

    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

    1. Flash Facebook Cookbook
      1. Flash Facebook Cookbook
      2. Credits
      3. About the Author
      4. Acknowledgement
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
        7. Downloading the example code for this book
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Getting Started with Flash and Facebook
        1. Introduction
        2. Setting up a new application on Facebook
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Downloading the Facebook ActionScript 3 SDK
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more
            1. The Flash Player version, or the AIR version of the SDK?
            2. What if I want to build my own Facebook library?
          5. See also
        4. Including the Facebook ActionScript 3 SDK in a Flash Builder project
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Linking source files to an included SWC
          4. See also
        5. Including the Facebook ActionScript 3 SDK as a Flash Builder library project
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Preparing your Flash Player application's HTML template for Facebook integration
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more
            1. Testing and debugging our Flash Builder project locally
            2. Where can users access our Facebook application from?
            3. Setting up a Canvas or Tab application on Facebook.com
            4. Working without the JavaScript SDK?
          5. See also
      9. 2. Authenticating with Facebook
        1. Introduction
          1. It's all about Access tokens
        2. Authentication with the Web SDK, for Flash Player applications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Automatic authentication with Facebook
            2. When should we launch the Login Dialog?
            3. The "options" parameter
          5. See also
        3. Authentication with the Desktop SDK, for AIR applications
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. How does the pop-up window work?
            3. See also
          3. Logging out of Facebook
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
          4. Retrieving information about the current session and active Facebook user
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Problems with the available permissions or the user object?
            5. See also
          5. Reacting to external session changes and JavaScript events
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Other events from Facebook
              2. Is your user connected, not connected, or unknown?
            5. See also
      10. 3. Working with Facebook Permissions
        1. Introduction
        2. Requesting permissions at login
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using the ExtendedPermission class, instead of using hardcoded permission names
          5. See also
        3. Checking for existing Extended Permissions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using the ExtendedPermission class constants to generate our FQL request
            2. What about FacebookSession.availablePermissions?
          5. See also
        4. Requesting additional Extended Permissions, following a failed API request
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Checking if a failed API request is caused by (a lack of) Extended Permissions
          5. See also
        5. Pre-emptively requesting additional Extended Permissions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      11. 4. Reading and Writing Data with the Graph API
        1. Introduction
        2. Building a 'Test console' for the Graph API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using an animation to indicate load progress
            2. Getting a human-readable JSON string from the API
          5. See also
        3. Loading a Graph API object from Facebook
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Converting raw results into ActionScript class instances
            2. Detecting errors in Graph API requests
            3. Usernames and Vanity URLs
            4. Using the 'me' shortcut to reference the current user
            5. /[OBJECT_ID] vs. [OBJECT_ID] in requests
          5. See also
        4. Loading specific data fields for a Graph API object
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The undocumented fringes of the Graph API
          5. See also
        5. Loading Graph API connections
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Handling responses with mixed results content types
          5. See also
        6. Loading multiple Graph API objects, in a single request
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        7. Limiting request lengths and paging results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Filtering requests to a specific time period
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        9. Loading a Facebook profile image
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Getting image URLs from Graph API objects
            2. GetImageURL and the 'me' shortcut
          4. See also
        10. Using the search capabilities of the Graph API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Creating, editing, and deleting Graph API objects
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
            3. See also
      12. 5. Loading Data with FQL
        1. Introduction
        2. Loading data with FQL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Formatting (pretty-printing) our FQL requests
            2. Using the FQL name classes to construct requests
            3. Using me() to reference the current user
          5. See also
        3. Using subqueries in FQL
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Loading the current user's family
            2. Loading a list of users that have been tagged in photos, alongside the current user
            3. Advanced data types in FQL
          4. See also
        4. Using logical operators in FQL requests
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Removing the current user from the results
            2. Excluding results with 'NOT IN'?
          5. See also
        5. Loading large data sets with FQL multiquery
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What's faster?
          5. See also
        6. Cross-comparing data sets to find overlapping results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Why use server-side comparisons?
          5. See also
        7. Sorting FQL results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Case-insensitive sorting
            2. Sorting results with advanced objects
          5. See also
        8. Limiting and paging FQL results
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Should we add limits to FQL requests?
          5. See also
        9. Searching for text strings in FQL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      13. 6. Facebook News Feeds and Status Updates
        1. Introduction
        2. Loading a user's status updates
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Displaying the "time since" on status updates
            2. Extracting and highlighting links in status updates
          5. See also
        3. Creating a status update with ActionScript
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Posting status updates to other user's walls.
            2. Privacy settings and status updates—who can see your updates?
            3. See also
          5. Posting a link with ActionScript
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Publishing internal links to a Canvas application
              3. See also
            3. Deleting a status update with ActionScript
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                3. See also
              3. Adding custom actions to Facebook posts
                1. How to do it...
                2. How it works...
                3. There's more...
                  1. Working with query strings and responding to custom actions
                4. See also
      14. 7. Comments and "Like this"
        1. Introduction
        2. Loading Comments for a Graph API object
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What type of objects can have Comments?
          5. See also
        3. Adding a Comment to a Graph API object
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Comments and privacy settings
          5. See also
        4. Deleting a Comment
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Knowing which comments can be deleted by the current user
            3. See also
          3. Retrieving Likes for a Graph API object
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. No Likes? Make sure you're using the object ID
              3. See also
            3. Adding a "Like" to a Graph API object
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Removing a Like from Graph API object
                3. See also
              3. Retrieving a "Like" count for a specified URL
                1. How to do it...
                2. Retrieving URL statistics with the Graph API
                3. Retrieving URL statistics with FQL
                4. How it works...
                5. There's more...
                  1. Requesting statistics for the current page URL
                  2. Requesting statistics for multiple URLs
                  3. Ensuring correct URL encoding for the Graph API
                6. See also
      15. 8. Working with Photos, Albums, and Tags
        1. Introduction
        2. Retrieving Photo and Album information from Facebook
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Loading Photos, without selecting an Album first
          5. See also
        3. Loading and displaying Photo Tags
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Creating an Album with the Graph API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Uploading Photos to Facebook
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Uploading Webcam or generated images to Facebook
            2. Adding a message to uploaded images
          5. See also
      16. 9. Working with Groups and Events
        1. Introduction
        2. Retrieving Facebook Group information
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Loading the current user's Groups
            3. See also
          3. Retrieving Group membership information
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
              3. See also
            3. Retrieving Facebook Events information
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Understanding and formatting time information from Facebook
              3. Plotting Events on a Map
                1. Getting ready
                2. How to do it...
                  1. How it works...
                  2. There's more...
                  3. See also
                3. Loading Event RSVP statuses
                  1. Getting ready
                  2. How to do it...
                    1. How it works...
                    2. There's more...
                    3. See also
                  3. Changing current user's RSVP status
                    1. Getting ready
                    2. How to do it...
                      1. How it works...
                      2. See also
                    3. Creating an Event on the user's behalf
                      1. Getting ready
                      2. How to do it...
                      3. Inviting friends to an Event
      17. 10. Checkins and Facebook Places
        1. Introduction
          1. Downloading and integrating the Google Maps API
          2. How to do it...
          3. Retrieving Checkin information for the current user and their friends
            1. Getting ready
              1. How to do it...
              2. How it works...
              3. There's more...
                1. Finding the user's most recent Checkin
                2. Exploring Checkins at a specific Place
            2. Finding Facebook Places near a specific location
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Searching for Places within a specific distance
                2. Creating and using custom Map Markers for our Places
              5. See also
            3. Integrating with HTML5 geolocation capabilities, Maps, and Facebook Places
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Dealing with Geolocation errors
                2. Using an overlay to represent geolocation accuracy
                3. Working with the native Flash Platform Geolocation capabilities
              5. See also
            4. Creating new Checkins at an existing Facebook Place
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Adding a message to a Checkin
                2. "Tagging" other users to include them in a Checkin
                3. See also
      18. 11. Bridging the Flash and Application Gap
        1. Introduction
        2. Launching Facebook UI dialogs from ActionScript 3
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. The display mode: Launching dialogs as inline iframes or new browser windows
            3. See also
          3. Imitating the Facebook.com UI in Flex
            1. How to do it...
              1. How it works...
              2. There's more...
            2. Displaying a Facebook-style loading indicator
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Adding a text message to the loading animation
            3. Creating the ApplicationBase class
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Using the ApplicationBase class, instead of the standard Application class
                2. Specifying Extended Permission requirements in our recipes
                3. Automatically executing code once our application is authenticated with Facebook
              5. See also