Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Facebook Graph API Development with Flash
Facebook Graph API Development with Flash

Facebook Graph API Development with Flash: Build social Flash applications fully integrated with the Facebook Graph API

Arrow left icon
Profile Icon Michael James Williams
Arrow right icon
$48.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (4 Ratings)
Paperback Dec 2010 324 pages 1st Edition
eBook
$26.09 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Michael James Williams
Arrow right icon
$48.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (4 Ratings)
Paperback Dec 2010 324 pages 1st Edition
eBook
$26.09 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$26.09 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Facebook Graph API Development with Flash

Chapter 2. Welcome to the Graph

Facebook has a huge store of information, on people, companies, events, photo albums, and more. It also knows how all of these are linked: which person owns each album; which people appear in each photo; which company is organizing each event.

For four years, this was accessed using a huge, sprawling API, which got more complex as new abilities were bolted on to it. In April 2010, Facebook launched the Graph API, greatly simplifying how developers can retrieve all of this data.

In this chapter we shall:

  • Explore the Facebook Graph

  • Learn what the Graph API is, and how it structures all the data on Facebook

  • Access public Graph data using AS3 and the Graph API

So let's get on with it.

Accessing the Graph API through a Browser


We'll dive right in by taking a look at how the Graph API represents the information from a public Page.

Note

When I talk about a Page with a capital P, I don't just mean any web page within the Facebook site; I'm referring to a specific type of page, also known as a public profile. Every Facebook user has their own personal profile; you can see yours by logging in to Facebook and clicking on the "Profile" link in the navigation bar at the top of the site. Public profiles look similar, but are designed to be used by businesses, bands, products, organizations, and public figures, as a way of having a presence on Facebook.

This means that many people have both a personal profile and a public profile. For example, Mark Zuckerberg, the CEO of Facebook, has a personal profile at http://www.facebook.com/zuck and a public profile (a Page) at http://www.facebook.com/markzuckerberg. This way, he can use his personal profile to keep in touch with his friends...

Time for action – loading a Page


Browse to http://www.facebook.com/PacktPub to load Packt Publishing's Facebook Page. You'll see a list of recent wall posts, an Info tab, some photo albums (mostly containing book covers), a profile picture, and a list of fans and links.

That's how website users view the information. How will our code "see" it? Take a look at how the Graph API represents Packt Publishing's Page by pointing your web browser at https://graph.facebook.com/PacktPub. This is called a Graph URL – note that it's the same URL as the Page itself, but with a secure https connection, and using the graph sub domain, rather than www.

What you'll see is as follows:

{
   "id": "204603129458",
   "name": "Packt Publishing",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs302.ash1/23274_204603129458_7460_s.jpg",
   "link": "http://www.facebook.com/PacktPub",
   "category": "Products_other",
   "username": "PacktPub",
   "company_overview": "Packt is a modern, IT focused book publisher...

Accessing the Graph API through AS3


Now that you've got an idea of how easy it is to access and read Facebook data in a browser, we'll see how to fetch it in AS3.

Time for action – retrieving a Page's information in AS3


Set up the project from the Chapter 2 start files, as explained in Chapter 1. Check that the project compiles with no errors (there may be a few warnings, depending on your IDE). You should see a 640 x 480 px SWF, all white, with just three buttons in the top-left corner: Zoom In, Zoom Out, and Reset View:

This project is the basis for a Rich Internet Application (RIA) that will be able to explore all of the information on Facebook using the Graph API. All the code for the UI is in place, just waiting for some Graph data to render. Our job is to write code to retrieve the data and pass it on to the renderers.

I'm not going to break down the entire project and explain what every class does, as the focus of this book is on using Facebook with Flash, not on building RIAs. What you need to know at the moment is a single instance of the controllers.CustomGraphContainerController class is created when the project is initialized, and it is...

Time for action – deserializing a JSON object


Adobe's as3corelib library contains a set of utility classes for serializing and deserializing JSON. It's available at http://github.com/mikechambers/as3corelib, but you don't need to download it, as it is already included in the \src\ directory of the project. (It consists of every class in com.adobe.*)

  1. In CustomGraphContainerController.as, import the JSON class:

    import com.adobe.serialization.json.JSON;
    
  2. Modify the onGraphDataLoadComplete() function so that it deserializes the JSON string to an object, instead of simply tracing the string:

    private function onGraphDataLoadComplete(a_event:Event):void
    {
      var loader:URLLoader = a_event.target as URLLoader;
      //obtain whatever data was loaded, and trace it
      var graphData:String = loader.data;
      var decodedJSON:Object = JSON.decode(graphData);
    }
  3. Trace the name property of this new object, to check that it worked:

    private function onGraphDataLoadComplete(a_event:Event):void
    {
      var loader:URLLoader...

Time for action – visualizing the info


Enough traces! It's time we displayed something in our actual SWF.

CustomGraphContainerController inherits a method called renderGraphObject() which will take care of this for us. All we have to do is pass it an argument of type graph.GraphObject.

GraphObject.as is a simple class; feel free to open it and take a look:

package graph
{
  import graph.controls.GraphObjectRenderer;
  public dynamic class GraphObject extends BaseGraphItem
  {
    public var rendererObject:GraphObjectRenderer;
    public var graphObjectListRenderers:Array = [];
    
    public function GraphObject()
    {
      
    }
    
  }

}

Honestly, there's no need to worry about any of the code there. All you need to know is that it's dynamic, which means that we can assign new properties to it during runtime, without having to specify their names beforehand. So we can do this:

var graphObject:GraphObject = new GraphObject();
graphObject.favoriteColor = "red";

When a GraphObject is passed...

Understanding connections


"That's all well and good," you may be thinking, "but it doesn't show all the data associated with the Page, does it? Where are the wall posts and photos?"

Time for action – finding connections in a browser


Facebook treats wall posts, photos, videos, and even statuses as separate objects within the Graph API, rather than jamming them all into a single Page object. For instance, here's an object representing a single Post by Packt Publishing:

{
   "id": "204603129458_127056137323572",
   "from": {
      "name": "Packt Publishing",
      "category": "Products_other",
      "id": "204603129458"
   },
   "message": "The Amazon SimpleDB Developer Guide has been published! Get your copy now! http://bit.ly/blFQUG",
   "picture": "http://external.ak.fbcdn.net/safe_image.php?d=c4a7887cb52dd8f93e439aaec13c034b&w=130&h=130&url=https%3A%2F%2Fwww.packtpub.com%2Fsites%2Fdefault%2Ffiles%2Fimagecache%2Fproductview%2F7344EN_MockupCover%2520Template.jpg",
   "link": "http://bit.ly/blFQUG",
   "name": "Amazon SimpleDB Developer Guide | Packt Publishing Technical & IT Book Store",
   "caption": "bit.ly",
   "description": "Gain in-depth understanding...

Time for action – rendering Lists of Posts


Since a Graph List's data property is an array of Graph Objects, we could just loop through the array and create a new Graph Object Renderer for each element. Feel free to have a go at this, if you like, but I've got another solution.

I've created a second renderer: this time, a Graph List Renderer. I've also created a class graph.GraphList. And CustomGraphContainerController inherits a method called renderGraphList(). Perhaps unsurprisingly, this takes an object of type graph.GraphList as a parameter, and creates a new Graph List Renderer to display its contents. So, we need to take a Graph List that we receive from the Graph API, and turn it into an instance of the GraphList class. The GraphList class is a little more sophisticated than the GraphObject class; it has a method called addToList(), to which we can pass any GraphObject instance to be added to the list.

We'll still loop through the data array, then, but instead of rendering each GraphObject...

Time for action – displaying a Graph Object's connections


The Graph Object Renderer has the ability to show a list of all the object's connections, if that list is included as part of the Graph Object.

All we have to do is tell the Graph API to give us that list when we request a Graph Object; since our code for creating an instance of GraphObject from a JSON copies all the properties of that JSON to the GraphObject, this metadata will be included too. So, actually, all we need to do is add the metadata=1 flag to the end of the Graph URL that we request, and it'll do the rest for us.

We could do this by changing our request code as shown in the following excerpt:

public function CustomGraphContainerController(a_graphControlContainer:GraphControlContainer)
{
  super(a_graphControlContainer);
  
  var loader:URLLoader = new URLLoader();
  var request:URLRequest = new URLRequest();
  //Specify which Graph URL to load
  request.url = "https://graph.facebook.com/PacktPub?metadata=1";
  loader.addEventListener...

Time for action – creating an HTTP Requestor


The idea is, we move all of the code regarding the URLLoader from CustomGraphContainerController to a separate class, called HTTPRequestor. We will then replace the CustomGraphContainerController constructor with this:

public function CustomGraphContainerController(a_graphControlContainer:GraphControlContainer)
{
  super(a_graphControlContainer);
  
  _requestor = new HTTPRequestor();
  _requestor.request(new GraphRequest("PacktPub"));
}

Why bother? Well, apart from being neater, there are two main advantages:

  1. It's much simpler to request several Graph Objects or Graph Lists; no need to deal with multiple instances of URLLoader.

  2. In the next chapter, we'll see how to use the official Adobe AS3 Facebook SDK to retrieve information from the Graph API. If all the code for a request is encapsulated in one class, then we only need to change one line to switch from using HTTP to using Adobe's SDK:

    public function CustomGraphContainerController(a_graphControlContainer...

Understanding Connections of Connections


Take a look at the Graph List Renderer created by clicking on the "album" connection:

Notice anything missing?

There are no pictures! We can see lots of photos when loading the Packt Publishing Page inside the actual Facebook website, but here there are no photo URLs at all. Check it out by loading the Graph List in the browser; even with ?metadata=1, there's no indication of where the photos might be:

{
   "data": [
      {
         "id": "471535759458",
         "from": {
            "name": "Packt Publishing",
            "category": "Products_other",
            "id": "204603129458"
         },
         "name": "Profile pictures",
         "link": "http://www.facebook.com/album.php?aid=280961&id=204603129458",
         "count": 1,
         "type": "profile",
         "created_time": "2010-09-30T10:13:53+0000",
         "updated_time": "2010-03-18T14:46:50+0000"
      },
      {
         "id": "307932939458",
         "from": {
            "name...

Time for action – loading photos from an album


However, as we've established, each object inside data is a Graph Object in its own right. Let's take a look at the Packt Books album, with id 307932939458, by browsing to https://graph.facebook.com/307932939458?metadata=1:

{
   "id": "307932939458",
   "from": {
      "name": "Packt Publishing",
      "category": "Products_other",
      "id": "204603129458"
   },
   "name": "Books",
   "description": "Packt Books",
   "link": "http://www.facebook.com/album.php?aid=180619&id=204603129458",
   "count": 32,
   "type": "album",
   "created_time": "2010-02-04T12:32:17+0000",
   "updated_time": "2010-03-18T16:08:42+0000",
   "metadata": {
      "connections": {
         "photos": "https://graph.facebook.com/307932939458/photos",
         "likes": "https://graph.facebook.com/307932939458/likes",
         "comments": "https://graph.facebook.com/307932939458/comments"
      },
   }
}

This time, the metadata gives us the information we need. The photos...

Putting it all together


Finally, let's see how far we can traverse through the graph, starting from the Packt Publishing Page.

Time for action – traversing the Graph


Set the Visualizer to start by requesting the PacktPub Page. Now, compile and run your SWF, and use the Connections box and the Pop Out buttons to explore the Graph, and see how far you can get. Don't forget you can drag Renderers around, and zoom out to fit even more in the Flash Player window! And remember, black lines signify connections, while gray lines signify that the object belongs to a List.

The following screenshot shows what it could look like after only a few clicks:

You can already see the resemblance to the sprawling diagrams of the Graph seen previously in the chapter.

What just happened?

You've written the code to power an RIA that allows you to explore the entire public Graph, starting from any point. In other words, you've made a Facebook crawler, in Flash.

Have a go hero – exploring other areas

You don't have to start exploring from the PacktPub Page. Try changing that initial GraphRequest instance to request the Facebook Page, Facebook...

Summary


We learned a lot in this chapter about the Graph API: not just what it is, but also how to access it in AS3.

Key things to learn:

  • The Graph API is so-called because it represents all of Facebook's data connected in an enormous graph of objects and connections.

  • The Graph API has two types of elements: Graph Objects and Graph Lists.

  • Graph Objects may have two IDs: a numeric one specified by Facebook, and possibly an alphanumeric one, specified by the Graph Object's owner.

  • Graph Objects have connections; connections lead to Graph Lists; Graph Lists contain Graph Objects.

  • The format of a Graph URL for retrieving a Graph Object is https://graph.facebook.com/graph_object_id.

  • The format of a Graph URL for retrieving a Graph List is https://graph.facebook.com/graph_object_id/connection_id.

  • Graph URLs return data in JSON format. This is a text-based format which uses key-value pairs to represent objects containing properties, arrays, and other objects.

  • Sometimes, Graph URLs return error messages;...

Left arrow icon Right arrow icon

Key benefits

  • Build your own interactive applications and games that integrate with Facebook
  • Add social features to your AS3 projects without having to build a new social network from scratch
  • Learn how to retrieve information from Facebook's database
  • A hands-on guide with step-by-step instructions and clear explanation that encourages experimentation and play

Description

The Facebook platform provides you with an ideal solution for building rich, social experiences on the web to develop an effective user experience application. Combined with Flash which effectively enables social interactions, you can create a fully functional application on Facebook. If you've been waiting to get started with your own applications and games on Facebook, with this book you don't have to wait any longer.This book takes you through everything you need to know to integrate your AS3 apps and games with Facebook accompanied by illustrative screenshots and short quizzes.It presents you with in depth coverage of the key underlying concepts such as creating a basic application that runs inside Facebook and exploring the Graph API which greatly simplifies how developers can retrieve data. This book also covers topics on security, permissions and authentication features on Facebook.This beginner's guide starts off by teaching you about retrieving simple public data and then rapidly working your way up to authenticating users, building powerful searches across the entire database, and uploading photos and other content. Throughout the book, you'll learn by building two fundamental components: an RIA Facebook interface and an AS3 SDK that you can drop into any project to add Facebook integration. This easy-to-understand guide has everything written as AS3-only projects with publicly available components, so you can follow along whether you use Flash Pro, Flex, or MXMLC – as long as you know AS3! This hands-on tutorial will present you with a whole new perspective of the three core aspects of Facebook – searching, retrieving, and updating the data .This practical book focuses on how to set up an application on Facebook and how to deal with different contexts like AIR.By the end of this book, you will be confident enough to set up your own application and create social interactions for users to share on Facebook.

Who is this book for?

If you are an AS3 developer who wants to create applications and games that integrate with Facebook – either on the Facebook website itself or off it, then this book is for you. Even if you have no previous experience with Facebook, databases, or server-side programming , you can count on this book.

What you will learn

  • Make your AS3 projects more social and personalise them for your users by adding Facebook integration
  • Grab information directly from Facebook into your applications by using Facebook s Graph API
  • Securely authenticate your users with OAuth 2.0 to log them into Facebook
  • Access information about your users and their friends directly from Facebook ‚Äì no need to make them type it all in again
  • Upload photographs, add wall posts, and create events through AS3
  • Search on Facebook s databases with the powerful Facebook Query Language
  • Build an AS3 Facebook SDK that you can drop into any AS3 project to add Facebook integration
  • Easily access both public and private Facebook data from the surface of a graph
  • Learn with exercises and fun examples illustrated with diagrams and screenshots
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 14, 2010
Length: 324 pages
Edition : 1st
Language : English
ISBN-13 : 9781849690744
Vendor :
Facebook
Languages :
Concepts :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Dec 14, 2010
Length: 324 pages
Edition : 1st
Language : English
ISBN-13 : 9781849690744
Vendor :
Facebook
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 103.98
Facebook Graph API Development with Flash
$48.99
Flash Facebook Cookbook
$54.99
Total $ 103.98 Stars icon

Table of Contents

8 Chapters
Introduction Chevron down icon Chevron up icon
Welcome to the Graph Chevron down icon Chevron up icon
Let Me In! Chevron down icon Chevron up icon
Digging Deeper into the Graph Chevron down icon Chevron up icon
Search Me Chevron down icon Chevron up icon
Adding to the Graph Chevron down icon Chevron up icon
FQL Matters Chevron down icon Chevron up icon
Finishing Off Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(4 Ratings)
5 star 50%
4 star 25%
3 star 0%
2 star 25%
1 star 0%
Juwal Bose Jan 27, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you are serious about FB (facebook) development, then i assure you this book is going to benefit you, so go ahead and buy it now. You can read the review later ;)So if any of you have tried FB development with flash, or with out flash for that matter, would definitely know that it is a PIA. The API keeps on changing every fortnight or so and even as i write this it had changed 2 days back, so you should hurry and get uptodate to give yourselves the edge thereby keeping ahead of all others. I am writing this review after half way through the book, realizing that I would end up spending a lot of time learning new things and testing new things related to the book. So i decided to spread the news right away as it would take time for me to finish it in a real sense.Let me list down the points that i noticed* Associated Codes are given in multiple formats, the Flash IDE, Flash Builder and Fashdevelop. This helps all kinds of users and we can easily see that even if your development environment is different, you can adapt the right one from any of these for your purposes.* Starts simple, gives you the code base for 'Visualiser' app which you can go through and understand how graph data is parsed and also as an added benefit you get to learn implementing Minimal comps. :)* FQL - get started with FB query Language, a very strong weapon in your FB development arsenal. If you have never used it, you will get to know what you were missing.* AIR deployment with StageWebView, which is the latest update with new flashplayer feature.* Start from scratch to deploy your app onto FB, either online or on desktop.* You may end up amazed by how easily we can poll graph data directly using the browser. Neat hacks and tips which can help you really understand how graph, connections etc work.* Searching for relevant data in the FB ocean.* Easily decode the json data returned by the graph using the AS3CoreLibSo this makes us realize that it is not for AS3 newbies, but you need to be good enough with AS3 to get started right away. Most of the support code of the visualizer app is not explained as it is out of context of the book, so you would need AS3 power to understand all those. You will find real solid OOP usage and implementation with examples which can really help out the developer in you even if you are not much interested in FB development. One thing i had noticed is that Michael could have used external Debuggers like Arthropod to show log data instead of a custom dialog event, but then we could easily make that change.So in the end, when it comes to FB you need to start early and proceed as fast as possible as social media is fast changing. FB is at the forefront of the revolution and we cant blame them for changing APIs so rapidly. This book surely helps you get started right away and get into the thick of things with the latest graph API and FB AS3 SDK. Even if you don't want to use the AS3 SDK (as updates for this is usually late when FB updates APIs) you can extend the native parsing information used in the earlier stages of the book to write your own classes for accessing FB data.So rush to download the book and get those source files and start exploring the vast FB ocean. Who knows what you may end up creating, but dont thank me, thank Michael.
Amazon Verified review Amazon
Rasmus Wriedt Larsen Feb 25, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've been so lucky to get a free copy of this book for review, and I must say: If you want to get into Facebook development, I would recommend this book to you!*** Overview ***You might be thinking: "Isn't this book only for Flash developers?" - Nope, it's also for everyone else who wants to learn how the Facebook Graph API works. It even has a chapter on the more advanced FQL (Facebook Query Language). Even if you have developed Flash applications for Facebook before, I'm sure you can find a lot of good tips in this book!It's very easy to follow, and include all the basic information you need to know. For each chapter, it goes though the general theory of the API (with examples), and then straight into how to actually use it.I would say this is a complete book for creating a Facebook application, with one little exception:Deployment - at least I experienced some trouble when I wanted to deploy my test application, but even though I had some trouble with it, I wouldn't say it has an impact on the overall quality of the book - it's still superb! (You can read my solution here: [...]*** Code ***It features code for FlashDevelop, the Flash IDE and Flash Builder, so no matter what you're using to code, you should be able to follow this book. It even has two folders for each chapter with code, one you can start out from, and one with the end result.This book is not about how to display the information you receive from Facebook. This is all handled by an UI the author supplies in the downloadable files. This is about how to get data from Facebook.The book uses two different methods for integrating with the Graph API, the official Adobe SDK, and a version the reader builds them self.*** Content of Book ***The book goes though getting basic information about anyone from Facebook, then getting authenticated so you can access information about the current user, to being able to get almost all the information Facebook has about the current user (if he allows it).Then it goes on to show how to add data entires to Facebook (posts, photos, albums, events, RSPSs, notes, likes, comments & checkins), and the few things you can delete from an application.It has a dedicated chapter on FQL (Facebook Query Language), which is a more advanced way of obtaining information from Facebook, that has some other possibilities - but also limitations.It ends off with a chapter with some very different information, how to deploy, edit and adjust your application on Facebook, how to integrate with AIR/Android, the Mochi Social Platform (for deploying on game portals) and other cool things!So if you're want to get into Facebook development, I would buy this book!
Amazon Verified review Amazon
Devon O Wolfgang Jan 24, 2011
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I am a Flash Platform developer who has created more FB applications than I care to recall. And I can honestly say that not once have I enjoyed it. 99 times out 100, the problems I have with Facebook applications stem from Facebook itself. It seems the API and terms of service change on a weekly (sometimes daily) basis. The documentation is horrendous and filled with code examples that simply don't work. The developer forums are filled with perfectly valid questions from frustrated devs that go ignored by FB administrators for days, weeks or just indefinitely. And the bug tracker at times seems overflowing with bugs marked as resolved which still regularly occur. And rather than hammer out all the problems with core functionality, Facebook spends its time trying out then removing new features such as the ability for app developers to acquire users addresses and phone numbers.But for all its problems, Facebook applications aren't, by default, a bad thing. And when Michael James Williams offered me the opportunity to check out a copy of his new book "Facebook Graph API Development with Flash", I jumped at the chance. Rightfully so, it seems. It turns out this book is a tremendous wealth of information. Whether you're just getting started or you've got a few hundred notches in your Facebook app belt, you're bound to find something useful in this book.One of the first really nice things you'll notice about this book is that it's development environment agnostic, at least as much as a book can be expected to be. When you download the related support files you'll find you get all the sample code laid out for the Flash Professional IDE, as a Flashbuilder project, or, my personal favorite, as a Flashdevelop project. So, regardless of your usual Flash workflow, you're bound to find some working examples that fit your style.The book starts off assuming you know a decent amount of Actionscript 3 coding, but nothing about Facebook development. You'll begin right off by making Facebook Graph API calls and examining the data and structures returned. You'll see how to easily convert the returned JSON objects into useable Actionscript objects (using classes from Adobe's as3corelib library openly available on github). And by the end of Chapter 2 you're basically already building a Flash powered Facebook application - easy peasy.The demo application that you build as you follow the book, while not exactly an exciting application in its own right, does a fantastic job of not only showing how API calls are made and returned but at visually demonstrating the various connections between Facebook objects - and connections are really what the shiny new Facebook Graph API is all about. Along the way, you'll not only learn how to write AS3 that integrates with Facebook from scratch but also how to use the 'official' Adobe/Facebook SDK. And the pop quizzes at the end of each chapter help get you thinking about the info you just learned as well as help that info `sink in' (though, I have to say, I wish the answers to the quizzes would have been included at the end of the chapter. I read the book on a Sony eReader and flipping to the end to see if I had the answers right or not was not really an option).For me personally, though, where this book really shines is in its introduction to FQL. Out of all the FB apps that I have built, I have never actually used FQL and can't even say why other than I never bothered to learn it. Now though, I can see how previous apps I have worked on would have seriously benefitted from it. In fact, I am actually looking forward to my next FB app, just so I can give FQL a whirl. If, like me, you have experience building Facebook apps with Flash, but have never bothered to learn FQL, this section of the book alone is worth the price of admission.Another section of the book that came as quite a pleasant surprise was a quick look at how to integrate Facebook functionality into an AIR for Android application using the StageWebView. This is very valuable and timely information I look forward to putting to good use.For as good as the book is, though, it isn't immune to all the problems with Facebook I mentioned previously. There are a few notable places where Michael provides some code examples then basically says, "This should work, but it doesn't. Maybe the folks at Facebook will fix this soon. Or maybe not". For example, just last week I was asked to integrate a Flash Facebook app into a tab of a fan page. After reading all the Facebook documentation and trying numerous things, I couldn't figure it out and settled for putting a static jpg image in the fan page tab that linked to the application page. So, needless to say, when I saw the chapter heading "Adding an Application to a Page Tab" mentioned in the table of contents, I was pretty excited. When I finally got to that section in chapter 8 though (I don't like to skip around in books, I read it straight through), I was more than a little perturbed to find this: "...it doesn't [work] at time of writing. Currently, tabs require FBML, rather than IFrames. But by the time you read this - and as already mentioned above - tabs will not accept FBML and will require IFrames. The documentation explaining how to incorporate IFrames into tabs does not exist yet, and it can't be tested, so unfortunately this book cannot explain how to do it. Sorry!" Well, at least that made me feel a little bit better about not being able to figure it out myself, but it doesn't really bolster my opinion of Facebook development in general.All things considered though, if you do any Flash / Facebook integration, I definitely recommend giving "Facebook Graph API Development with Flash" a read. You will certainly find something there that will make your life a lot easier. As the book itself indicates, it doesn't just simply throw a collection of code snippets at you, but gives an insight to the structure and organization of Facebook data, making it a little less stressful to deal with the inevitable changes you are bound to run across when developing for the FB platform.
Amazon Verified review Amazon
Shecky Bonus Nov 20, 2013
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The book is written as a soup-to-nuts project, rather than a cookbook. Since a lot of the pieces are out-of-date (FB constantly changes APIs), the whole thing is a flop.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon