AS3 Facebook Graph API Branch


Posted on March 6th, by Mark in Flash, Flex. 8 comments

AS3 Facebook Graph API Branch
Back in May of last year, I was getting frustrated with the lack of support in Adobe’s official Facebook ActionScript library. In fact at that time, the library that claimed it was “fully supported by Facebook and Adobe” had not been updated since December 1, 2009. At the same time, Facebook was fully pushing their new Graph API.

At my job, I was starting to do a lot of Facebook work and was constantly seeing posts about Graph. Instead of waiting on Adobe, I started to edit their library locally to add support for Graph. I mentioned this on the issue tracker of Adobe’s library to see if anyone would be interested, and several people responded favorably… but no one from Adobe responded at all.

At first, I was pulling in the new Graph JS SDK on our site, initializing the user with it directly, and had just made a few line changes in the library to make the same old REST calls using it instead. This was just a bridge to start working with Graph. Once I had the user initialized with it, I was able to start taking advantage of the new calls. I then started making more changes, next supporting the JS SDK’s UI methods and then the actual API. After a few months of writing and working with the library in a production environment, I decided to upload my branch of the library to GitHub.

I did this at the beginning of September. Between May and September, several people were complaining about the complete lack of support of the official Adobe library with no response at all. In fact, Jason Crist the original author of the library who handed over control to Adobe was getting frustrated with the lack of support as well and reached out to me about joining forces on the new library. But within a week of just talking about it, Adobe comes out of the blue and says that a new library with Graph support was coming. They were obviously working on it for a while, because the day after they announced that, it was uploaded. Thanks for the head’s up Adobe!

So if you’re keeping tabs, the officially supported library didn’t see an update from December 1, 2009 through September 30, 2010. That’s almost 10 months. So you’ll forgive me if I didn’t believe this new library would be supported any better. I did however like what they had done with the library, most of it that is. I decided to rewrite my library again, but this time based on the new Adobe library. I continued to maintain my branch for several reasons: support being the biggest, a few issues I was noticing with the new library, and lack of typed value objects for the returned data.

As I find issues with the core library, I update them in my branch. Most of these changes in turn get implemented into the core library. In fact, I was annoyed that the new library required an external JS file and a special way of embedding the swf, so I rewrote the JS in an ActionScript class that gets injected into the HTML at runtime, and Adobe now uses that class directly with no modification. I reached out to Adobe to see if I could become a committer on the library, they responded, but unfortunately didn’t seem too interested. So instead I continue to maintain my branch.

Long story short, if you’re using the officially supported AS3 Facebook library, you might want to check out my branch too. You might just find that your issues and suggestions get taken into account faster, if Adobe does make any updates to their library, I make those updates as soon as I notice, and you might like having typed objects for the returned data (like FacebookUser instead of just a generic object with the user’s info).

Get it here: https://github.com/yourpalmark/facebook-actionscript-api
Docs: http://yourpalmark.github.com/facebook-actionscript-api/docs/

I also maintain an AIR branch as well: https://github.com/yourpalmark/facebook-air-api
Docs: http://yourpalmark.github.com/facebook-air-api/docs/





8 thoughts on “AS3 Facebook Graph API Branch

  1. I remember that Adobe talked a lot about their NEW FB library. 3 days later it was already obsolete and it took 10 month to update as you said. It’s a shame…

    Facebook API is moving too fast, and Adobe too slow… Thanks for the library but i’m pretty sure it will be outdated in a few months (weeks?) only. Do you plan to maintain it ? If yes, for how long ?

  2. Hey Fardeen,

    Good questions.

    1) I do plan to maintain the library for as long as I can, but if I get hit by a bus or just can’t take another Facebook game invite and kill my account, GitHub allows you to branch libraries instantly. Someone else will take over. Yay!

    2) My big problem with Adobe was that Graph was out for at least 6 months before Adobe even talked about Graph support, and then the next day it was up. This was a huge change from Facebook, not just an added feature. Adobe can’t just go black like that if it is a supported library.
    Now with the Graph API, Facebook has spent a lot of time , effort, and money on promoting it, so I don’t think they will be switching gears anytime soon like they did on their REST API. What this means is that sure Facebook will be constantly adding features, but they probably will not be rewriting their entire platform anytime soon. This library can be used instantly when new additions get added… that’s actually the beauty of Graph, its all standardized, just hit the same url with the id of the new Facebook feature that just came out, and voila you’ve got that new data.

    Now if I’m wrong, again someone else can instantly jump on and take over. This should be a community library.

  3. Thank You! For sharing your nice Graph API adobe’s on steroids version, I’m looking forward to implement it and to help with improvements.

  4. Hi Mark,

    great work, i went straight from the official to this one and very happy with it.

    I do have a question maybe you can answer or another one of your readers here. Some players log out and switch between Facebook accounts. I noticed the AS3 lib saves the cookie in the flash cache. We are noticing that this doesn’t get refreshed when a different user logs in and tries to enter our game. Is there a solution to forcing or ensuring that the session/cookie data always matches the currently logged in Facebook user ?

    Thanks again for this contribution to the community

  5. Have found this library really helpful – thanks

    Just looking at FB Credits now but I cannot seem to get the Pay Dialog to fire up – the flow seems more complex than for other Dialogs – but is there any reason why I could not access this through the Facebook.ui call ?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>