Now, I should begin by saying I absolutely hate building Facebook applications. And I build a lot of them at work. Every time I get the word from above that we’re doing another FB app, I just groan – both inwardly and out. It’s become a running joke of the office. Why do I dislike Facebook apps so much? After all, I say to myself, they’re really just little Flash widgets and whatsits (at least the ones we do) that have to make a few extra calls to the Facebook API to tie the thing to a social platform – and I love building things with Flash and actionscript. Well, occasionally, the trouble is the client who asks for a Facebook application with absolutely no idea what they would like it to do or what it’s even capable of doing. These are companies simply trying to keep up with the Joneses of the social networking age who probably read in last month’s edition of some Digital Marketing magazine or other that Facebook applications are the “Way of the Future” in getting your product noticed. Facebook applications, in and of themselves, aren’t necessarily a bad thing, but they exist to perform a service in one way or another. If you don’t know what you would like a FB app to do, or little things like you need to login into Facebook for Facebook apps to work, or that Facebook applications can exist outside of the Facebook site, the odds are you don’t need one.
99 times out 100, though, 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, as I stated earlier, 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.
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.