I wrote a book!
Early last year, I signed a book deal with Packt Publishing. I spent most of 2010 working on it, and it’s finally finished, published, and on the shelves.
The book is a beginner’s guide to creating Flash Facebook applications and games. That includes apps like Graffiti and games FarmVille, which are designed to be played entirely within Facebook, as well Flash projects hosted outside Facebook that tap in to the user’s Facebook profile and friends list to give a more personalised experience.
Who is it aimed at?
When I say ‘beginner’s guide’, I mean that you don’t have to know anything about Facebook integration or server-side scripting or SQL in order to start. You’ll need a basic understanding of Flash and AS3, but no more complex than you could pick up from my avoider game tutorial.
So the book is aimed at you, if you know how to build Flash projects and are interested in hooking them up to that huge social network.
What does it cover?
Okay, okay, maybe I shouldn’t have mentioned FarmVille up there. This book isn’t going to walk you through building a FarmVille clone. If it did, it couldn’t be very helpful; it would have to cover game design, and animation, and a whole bunch of other topics that have nothing to do with Facebook.
Instead, it’s all about Facebook integration. I’ve made sure to explain all the AS3 classes and libraries that some readers may not be familiar with, but apart from that, the book has a single focus.
At the start of the book, you’re given source files, containing the user interface code for a Flash project called Visualizer. This is an app which lets the user explore all the information available on Facebook — including their profile information, their photos, their friends list, their friends photos, and more — but it’s missing all of the code required to hook it up to Facebook.
As you work through the book, you’ll write that code yourself, learning how it all works without having to worry about designing or developing the user interface. (Again: a single focus.) After building each new feature from scratch, you’ll learn how to integrate the same feature using the official Adobe Facebook SDK; this way, when you work on your own projects, you’ll have the freedom to design your own solution, and the knowledge to use the standard one.
Each chapter is roughly twice the length of one of my longer tutorials (like most of the parts of the avoider game tutorial), and they’re designed to be worked through in sequence. Let me break down what each is about:
- Introduction explains why you should care about Facebook, what you’re going to do in the book, how to get setup, what you need to know before continuing, and what to do if you don’t already have that knowledge.
- Welcome to the Graph introduces the Graph API, Facebook’s model for connecting all of the information that it stores. By the midpoint of this chapter, you’ll already be retrieving data from Facebook.
- Let Me In! is where things get really interesting; you’ll learn how to let your user log in to Facebook through your app, allowing you to retrieve their personal data — and that of their friends.
- Digging Deeper into the Graph is all about paging and filtering the data you retrieve from Facebook, so you can look into the past. It also introduces you to the most annoying bug on the whole Facebook platform.
- Search Me, as you can probably guess, explains how to search for posts and users from specific criteria. By the end of this chapter, your project will have a feature that even the Facebook website itself is missing.
- Adding to the Graph is where you go from being a passive observer to an active creator; you discover how to create new wall posts, upload photos, and so on.
- FQL Matters is different to all the other chapters; it has nothing to do with the Visualizer. You could skip it, but I recommend that you don’t, because it introduces you to the Facebook Query Language, a powerful tool for extracting data from Facebook.
- Finishing Off covers a grab-bag of miscellaneous important topics that didn’t really fit anywhere else. How to embed your project inside the Facebook website; how to use what you’ve learnt when building an AIR (or AIR for Android) application; the problems with portals; and what to learn next.
All that in about 300 pages
Won’t it become outdated?
Facebook’s developers move quickly. Really quickly. The Facebook Platform is always shifting and changing. This was my major concern when planning the book; I was worried that all the information in it would be out of date before the ink was dry.
So, rather than giving you a set of instructions and code snippets to copy, I focused on explaining the underlying concepts of Facebook development. Once you’ve read the book, you’ll understand how Facebook works, and you’ll be well-equipped to deal with whatever changes Mark Zuckerberg’s team throws at you.
For example, in Adding to the Graph, I explained how to “like” a wall post, but said that it was impossible to “like” a comment on a wall post through code. This was true when I wrote it, but not any more. So what? If you understand how to “like” a wall post, you’ll be able to apply that knowledge to comments.
A section in Finishing Off explains how to keep up to date with all the improvements made to the platform, so you would be aware that it was now possible to “like” a comment, and could simply add this information to the understanding of the concepts that you’d already built up.
Isn’t all that information available online?
Yeah, there’s a lot of information about Flash Facebook development available online for free. There’s the official documentation, there are tutorial blogs (of course!) and there are forums. I learnt everything I know about Facebook development from these free resources.
But you have to ask yourself whether it’s worth your time. The information is spread across different sites. A lot of what you’ll read on blogs and forums is speculation, like “to do X, you must first do A, B, C, and D” when actually only B is required. Sometimes it’s just plain wrong. The platform has bugs, and sometimes even the information in the official documentation doesn’t do what it claims to.
My book gathers all the correct knowledge from these various sources, and puts them in one place. Then it structures it, using a combination of Packt Publishing’s techniques and my own, in an order that’s designed to help you learn.
In other words: I spent months piecing all of this together. You can bypass all that time (and that frustration, when things just don’t work) for a few dollars. Whether that’s worth it to you depends on how much you value your time. Or how much of a masochist you are, I suppose
Where can I get it?
I’m glad you asked Both PDF and paperback versions are available for sale on the Packt Publishing webpage for the book.
Otherwise, you might be able to find them in your local bookshop, assuming you still have a local bookshop.
Can I read some of it RIGHT NOW?
The second chapter (which is where you start writing some code to actually get data from Facebook) is available for free online.
I hope you like it! And if you do get a copy, I’d really appreciate it if you’d post an honest review on Amazon. I’d also love to see what you make with it, so post a link to your creations in the comments below
And let me quickly thank the whole of the Packt Publishing team, as well as Emanuele Feronato (who did the technical editing for the book) and Keith Peters (who wrote the awesome Minimal Components that I used for the Visualizer).
Rasmus Wriedt Larsen wanted to add functionality that redirected the user to the login page if they weren’t already authorised… so he did! You can see his implementation here. Thanks for sharing it, Rasmus!