One of the most challenging and, at the same time, entertaining task I was assigned to lately was to implement a functionality for a full-flash website (developed in Flex) that allowed it to communicate with Facebook and have it change the user’s status automatically.
Facebook is a huge social network and a wonderfully designed application. And, as many other large web apps, it supplies us with their very-own API – which is great. It allows us access to their huge collection of users and provides us with great opportunities for extension.
Facebook is evolving, and so is the code that allows us to communicate with it. The documentation, however, is very poor and part of it is outdated. Most of the AS3 samples provided on their website no longer work (shame on you, Adobe) and the methods lack description in the reference.The PHP code comes with no documentation what-so-ever.
I began the implementation but got stopped early in my tracks – the popup window for the Facebook login wouldn’t pop. FB.Connect.requireSession() was working well when called from an onclick handler but did nothing when it was executed by my AS3 code. Very frustrating: no errors, no messages, nothing.
So the digging began, and the deeper I went, the more fascinated I was by the wonderful design and quality of their code. I managed to track down the problem – requireSession() would halt if it wasn’t called from within a click handler, thus enforcing direct user interaction with the website.
FBIntern.Utility.get_isInUserActionCallstack() was responsible for this, so the easy way around it was a simple overwrite* – and voila!
All in all, though, it was a wonderful experience!