wellconsidered

dev blog 

Facebook Graph API & Flash

I've been working with Facebook and Flash integration a lot since a year or two. There are a couple 'libraries' I created and the last one is still being used at our Proximity BBDO office. It works. But it'll become deprecated, and this deadline is getting closer and closer.

Facebook released it's Graph API a while ago and it depends on OAuth 2.0 for authorization which is kind of tricky to do in Flash.

This guy came up with a nice solution: http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/ 
It uses popups and a javascript callback for authorization, which makes it pretty easy to implement. 
I've been testing it and it still stands, thus making it a potential replacer for our current library.

 

Filed under  //   actionscript   api   as3   facebook   flash   graph   oauth  

Comments [2]

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 chose 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 simplify 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 it 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.

Comments [13]

Facebook Connect & OpenSocial: Libraries

From time to time I tend to release some code we produce at Proximity BBDO. Most of the time they are related to implementations of existing code libraries: wrappers for Javascript frameworks like Facebook Connect and OpenSocial. There have been a lot of questions lately about the whereabouts of the libraries, so here's an overview. Note: I know I'm mixing git and svn, but the reason is that we use svn at Proximity BBDO and I use git at home, so the libraries are on svn and the examples and javascript/html files are on git. Sounds stupid, but I think you should learn both VCS technologies anyway :)

Actionscript 3 - Facebook Connect Flash Bridge

A Javascript to Flash bridge to connect to Facebook through the Facebook Connect library. Some examples using the library can be found at http://www.thefwa.com/50million/ and various campaigns we produce at Proximity BBDO (Belgacom, Pepsi, Cecemel, ...). There is a refactor in the work. Stay tuned! Work example at http://stream.microsite.be/cecemel The Actionscript 3 library at http://code.google.com/p/as3fbflashbridge/ The Javascript + HTML files at http://github.com/pierot/fbflashbridge/tree/master

Actionscript 3 - OpenSocial Flash Bridge

Applications deployed on a social platform implementing OpenSocial (like Netlog, Orkut and MySpace) can use this Javascript / AS3 library to connect to all some of the features of OpenSocial in a Flash website. Work example can be found at http://stream.microsite.be/dev/netlog/osflashbridge.xml (you need to run this in an OpenSocial sandbox). The Actionscript 3 library at http://code.google.com/p/as3osflashbridge/ The Javascript + HTML files at http://github.com/pierot/osflashbridge/tree/master

Actionscript 3 - Google Friend Connect Flash Bridge

Based on the OpenSocial Flash Bridge, the Google Friend Connect Flash Bridge leverages the login capabilities of Google Friend Connect for Flash websites. You need the OpenSocial Flash Bridge to use this one. Work example can be found at http://stream.microsite.be/dev/as3googlefriendconnect/ The Actionscript 3 library at http://code.google.com/p/as3googlefriendconnect/

Actionscript 3 JayRock Wrapper

Very small project which connects to a JayRock service built in .NET. More info on JayRock: http://jayrock.berlios.de/ The Actionscript 3 library at http://code.google.com/p/as3jayrock/

Comments [0]

Adobe and Facebook, Connect

Adobe and Facebook have connected since last week. Adobe has picked up an open source Actionscript 3 library from Google Code and reworked it to an official Adobe library for Flash applications on Facebook. Since there are 10.000+ applications on Facebook and countless of them are made in Flash, the developer base who benefit from this is huge. Which is great of course. The library supports Facebook Connect as well, so, people developing for the Facebook platform can easily reuse there code if they want to incorporate Facebook Connect for external use. It works kind of the same as my implementation: using a small javascript side and fully implemented actionscript part. I would encourage you to start using the officially supported library as it is ... supported and fully implemented :) Have fun developing for Facebook!

Comments [0]

OpenSocial to Actionscript 3

I've been busy exploring the various social platforms for campaign integration. At Proximity BBDO we have successfully launched a campaign with Facebook Connect for Cécémel and our first OpenSocial integration on Netlog for Snickers. Both frameworks are very alike and different at the same time. Facebook Connect extends an existing framework, that was available on Facebook itself for application development, and allows you to leverage the same functionality on any external site. This is great, because your website can be loosely coupled with Facebook and still keep its own identity and branding. OpenSocial requires your application to live on a platform that supports OpenSocial. It is more a library that is available to you that is built with a certain feature set and OpenSocial is the interface to it. You may also notice that I talk about an application instead of a website. It's not that websites can't use OpenSocial as such but it goes more to the application direction. From an advertising perspective, both frameworks can work for a campaign, the success depends more on the platform you choose than which framework you are going to implement. You may have seen my last blog post about a Facebook Connect to Flash bridge and so now, there is a second Flash bridge, for OpenSocial this time. We used it internally for the Netlog application and it turned out to be pretty easy to utilize. An example application can be tested in the sandbox of your preferred social platform which supports OpenSocial (Netlog, Orkut, MySpace, ...).

There are some downsides when using the library on different browsers. When in production, OpenSocial sometimes sends different formatted objects with results back to the front-end. I'm not sure why it happens in IE7 on one machine and doesn't on another machine. Those little things, we fixed for now but it still requires some more testing and debugging. If you have any questions about, or you want to download the full library, drop me an e-mail at pieter@wellconsidered.be or pieter.michels@proximity.bbdo.be.

Comments [0]

Facebook Connect to Actionscript 3

Facebook has launched Facebook Connect a little more than a month ago and it has seen a major adaptation on the Internet now. We've seen it in action on TechCrunch, Digg, Vimeo and a dozen of other sites. Together with Google Friend Connect (and maybe MySpace Data Availability) it announces a time of one social profile on multiple sites with features like friend linking, profile information exchange and bunch of easy tools for content sharing (on Facebook for instance). At Proximity BBDO, we try to make user integration and participation on campaign sites as easy as possible and just hitting the 'Connect with Facebook' button is easy. I've been working on a bridge to link the Javascript implementation of Facebook Connect to a Flash or Flex site. An example of a Facebook Connect Flash application can been seen here. It currently supports automatic login, retrieving friend list and friend information (can take a while), current application users, sharing a link on Facebook, posting a predefined story and updating your story (make sure you set the status permissions first).

I have deliberately chosen to fully implement the results in Flash rather than merely providing a wrapper for the Javascript calls and dealing with the result in Flash itself. At the moment I'm of course limited to the things I program in Flash (the calls and the results). But as we have to deal with automatic login and javascript popups, this way was easier to integrate in a Flash website and, moreover, the Javascript library is built with a HTML website in mind. So, it allows you to use the same library in your average website and listen to any event that passes along (login, disconnects, friends, a status that has been set, ...) Update: I have included the inviting of friends as well. They will receive an invitation for the application in their Facebook inbox. One downside, at the moment, is that there is a redirect after successfully inviting friends. I'm still working on fixing that. Update 2: The code library is available at github.com as project FBFlashBridge.

Comments [4]

Searchable Video Content

This is the second post of my Adobe MAX Milan '08 notes. Read the first one about Adobe FMS 3.5 and multi-bitrate streaming. The idea isn't quite new: we've been tagging our video content for a long time now and we think we cover pretty much of the contents of our media. But imagine you could literally copy paste the exact words spoken in video or audio content and use that to search on.. First, let me tell you how it works. Adobe Creative Suite CS4 implements the first basics of this technology by allowing video and audio to be processed by their transcriber found in Soundbooth and Premiere (not sure After Effects can do it too). It reads out the audio and transcribes each word, identifies up to 2 different speakers, supports multiple languages (different types of dialect of English, French, Spanish and German) and only needs a maximum processing time of 1.5 times the length of the media clip. That's not too bad I think. I can think of a dozen of usable opportunities such as advertising being delivered at real time based on the words just spoken or to be spoken, huge archives of media content effectively searchable (VRT, VMMa, ...) via a custom built platform (Adobe is planning on releasing an SDK for the technology) or just Google (they wouldn't hesitate to use this kind of tech I guess) or making all media content any-surfer proof... One nice feature in Flash is that you can read the metadata of FLV, so effectively, you are able to read out the transcriptions that are saved in the metadata of video files. This makes implementing the above suggestions very easy.

Comments [0]

Published in O'Reilly

I'm thrilled to announce that the component for Webservices in Flash CS3/CS4 has been published in a recently released book of O'Reilly. I have to thank David Stiller for this as he guided me towards CS4 compatibility and eventually the mentioning of the component. See how proud I am :)

Comments [0]

Building *.mxp extensions for Flash CS4

With the creation of the Webservice classes I created an *.mxp extension for Flash CS3 as well, knowing that a lot of people would request it (and they did). It all worked very well until I got contacted by David Stiller from quip.net telling me he was going to mention the class library in a new book from O'Reilly (The ActionScript 3.0 Quick Reference Guide: For Developers and Designers Using Flash CS4 Professional). David ran some tests in (at that time not yet released) Flash CS4 and the extension wouldn't work at all. He stated the following:

The AS3 compiler in Flash CS4 expects your WebService classes to extend MovieClip, which seems to be happening by virtue of their being components (i.e., quasi movie clip symbols).̆ The easiest solution might just be to extend MovieClip, and I'll be happy to test your updated component files.̆ Of course, from an OOP perspective, nothing in your code actually requires this, so the alternative is that you build your components in a slightly different way.
So I was left with the very extensive article on Adobe Devnet on how to create extensions for Flash CS*. But alas the article wasn't much of a help as the information included was so vast that soon I was lost. But after some trial and error I managed to create the extension and David confirmed that it worked in the upcoming CS4. So here's how it was done:
  1. Open new *.fla file
  2. Create a blank MovieClip
  3. Go in to the MovieClip
  4. Import the base classes (in my case it was Operation, OperationEvent and WebService class)
  5. Right-click MovieClip > Select Export SWC file
  6. Finally create the extension with an *.mxi file
It's that easy. Moreover, it seems all very logical but as I don't code in the Flash IDE and created everything in Adobe Flex Builder 3, my *.swc was compiled in Flex Builder and apparently that caused the problem. I can also say that this is not the adviced way to do so, but it works for me and it might just work for you as well. So now, I can proudly say the Webservice component extension works in Flash CS4. Great! :)

Comments [0]

RTMPT problems with WebORB in as3

At Proximity BBDO we've been working on a nice case for Belgacom: Internet is mine! (Mine I tell you!) You can claim the internet by simply pushing a button: that's it, you're now the owner of the internet .. until someone else claims it. The switching between owners is going fast, very fast. So, what did we use to accomplish the real-time interaction between visitors? Right, some push technology delivered by Red5, Flash Media Server or WebORB, to name a few. We used WebORB .NET from The MidnightCoders for our project, it has a tight integration with our existing .NET working environment and allowed direct communication with our SQL databases. The first tests we did were pretty neat, a hundred connections and constant pushing (figuratively and literally speaking) were being processed without a flaw. But as the application grew more complex and a lot of database interaction happened at each click/push we encountered some hiccups now and then; traffic congestion, time-outs and just general slowness. One of the reasons, was are choice of transfer protocol. At first we used rtmp as a protocol but our experience with other projects was that rtmp (defaults at port 1935 and for WebORB port 2037) gets blocked by corporate firewalls leaving a part of the visitors out of the fun. So we directed all traffic to port 80 and so changing the protocol to rtmpt. And this seemed a bad idea.

  • Speed is considerably lower on rtmpt than on rtmp.
  • Packets being sent are larger as they contain additional HTTP headers
So, after problems raised we had to change everything back to normal. Rtmpt wasn't a valid choice in this situation as we required real-time push from client to server and server to client for hundreds of connections. The bad news now, is that probably some users won't be able to participate on the website. But thus far we haven't received any complaints (thank god). So, consider all down-sides before choosing the more 'safe' rtmpt protocol over rtmp. I warned you, so don't come crying afterwards :)

Comments [0]