FBFlashBridge: v0.1
0.1. That’s right. A new version. There won’t be a 0.2 or so but it looks nice, don’t you think?
Anyway, I threw away the old library (http://www.wellconsidered.be/blog/2009/01/04/facebook-connect-to-actionscript-3/ all comments are closed now) and reworked the idea of a library and choose an implementation more based on Javascript and less on Flash. More on generic output instead of nicely formatting everything.
This is how a common request will happen now:
- you call a Javascript specific function (the ones that are implemented in the lirbary) from Flash
- Javascript sends the request to Facebook
- Facebook returns result as described in their API (so they are subject to change if Facebook decides to)
- Javascript captures response and sends it as a native Flash object/array to Flash
- all the parsing is done by you in Flash
Why did I simplified it so much?
Well, first of all there is a very extensive official library from Adobe itself which does everything you need. It is kind of useless to maintain an obsolete library. That one is very obvious, isn’t it?
Secondly, I find the quite dangerous to support a third party interface on two levels: Javascript and Flash. So I didn’t do any Flash implementation, except for the calls to Javascript.
Lastly, the library is now, more than before, perfectly useable in an HTML / Javascript application. I gave it an as3 touch so you can easily work with eventlisteners and more.
Code examples
Also available on Gist
Javascript startup
Flash setup
Documentation
You can find a generated jsdocs at http://fbflashbridge.wellconsidered.be/docs/. The sample application at http://fbflashbridge.wellconsidered.be/ will show you how requests are given to Flash and thus how you need to parse them accordingly.