Flash Application Communication Within Facebook
We recently ported a Flash-based game to Facebook and were faced with some of the challenges of the Facebook platform imposes on Flash apps, mainly the limitations Flash applications have when communicating with their “container” (the Facebook canvas page).
When building and integrated a Flash app with its container, many situations come up that require you to pass information into the Flash application (via Javascript or Flashvars) and get information out of the Flash application (via Javascript or a redirected URL and a query string). Anyone who has build a more complex Flash application knows what I am talking about! Unfortunately, Facebook doesn’t support the type of communication.
Since Facebook doesn’t support external communication via Javascript or FBJS, and since Facebook doesn’t support navigation by the Flash application (via navigateToUrl or getURL), it becomes difficult to convert more complex Flash/Flex applications and widgets into Facebook application.

Since we do a lot of Flash to Facebook porting work for clients, we have to develop workarounds to many of the problems that plague Flash apps on Facebook. Here is one such solution:
Enabling Flash to Facebook Book to Flash Communication:
- Put your Flash application in an IFRAME within your Facebook Canvas Page
You can pass information to your Flash application (located in the IFRAME) by passing a query string (<IFRAME src=”flash.php?value=x”…>). The PHP page in which your Flash application sits, picks up query string (“value=x”) and passes the parameters as a Flashvars to the Flash application (<EMBED src=”..” flashvars=”value=x” …>). - Your Flash application communicates back to your Facebook Application using getURL(”..”,”_top”,”GET”)
Since your Flash application is in an IFRAME, navigateToUrl or getURL will work! The trick is to make sure you get using GET and setting the target to “_top”, the URL should be a URL to a Facebook Canvas Page (http://app.facebook.com/myapp, i.e.). This way your Flash application can pass information via a query string to your Facebook Canvas Page. - Your Flash Canvas Page picks up the information from the query string
Voila you are done! You passed information into your Flash application (such a a username, i.e.), and you got information back from your Flash application (use as the high score, or test results, i.e.)! Complete 360!
If you having problems porting your Flash apps and widgets to Facebook, let us know! At Metablocks, we love solving hard problems, especially Facebook related ones!
Most Recent Posts
- Google is Indexing Adobe Flash Files (SWFs) - SEO for Flash Widgets? - December 16th, 2009
- Widget News and Trends: Dec 16, 2009 - December 16th, 2009
- Recent Widget Blog Posts - December 15th, 2009
- Matthew West's Facebook Page - Why Every Artist Needs One! - December 14th, 2009
- CareerBuilder "Re-selling" Facebook? Yikes! - December 14th, 2009
Last 5 posts in Development
- Developing on the Yahoo! Open Application Platform - June 24th, 2009
- Designing Good APIs - June 23rd, 2009
- The Facebook Ninja Returns - February 14th, 2009
- Thanks Facebook for the "Add"! - February 14th, 2009
- Ninjas Guide to Facebook Application Integration - February 13th, 2009



[...] In more technical terms, navigateToUrl and getURL by default do not work in Facebook (See work around) [...]
Pingback by Metablocks | Facebook API and Adobe Flash: Marriage Not Made in Heaven - Widget, Gadget and Social Media App Design and Development — July 1, 2008 @ 8:48 am
Hi,
Great fix, thanks! Is it not possible to POST variables to a Facebook canvas page? I’ve had a go and it seems to stumble – wondered if you’d got round it. Just wanted to use this technique but not have my variables appended to the end of the URL.
Thanks!
Rich
Comment by Rich — September 9, 2008 @ 10:08 pm
Hey, great article!
Comment by Valentino Tombesi — October 5, 2008 @ 9:47 pm
[...] only way to get a Flash Widget onto Facebook is to wrap your widget in a Facebook application. You can develop (or have someone develop) that from scratch or if you already have a ClearSpring [...]
Pingback by Metablocks | ClearSpring Facebook Support: Quick and Easy FB Apps? - Widget, Gadget and Social Media App Design and Development — December 29, 2008 @ 5:44 pm
I do have a facebook application where I have wrapped the clearspring widget. The problem is how to get it shown on my fan page becasue
a) IFRAME feature doesn’t work in static FBML box provided on Fan page.
Any workarounds…?
Comment by Yogesh — February 12, 2009 @ 6:23 pm
The only work around is do build your own Facbook application to wrap around your Clearspring-enabled Flash object.
Comment by admin — February 12, 2009 @ 9:21 pm