15 August 2011
The Flash Platform lets you build rich, user experiences. The Facebook Platform lets you build rich, social experiences. Put the two together, and you can build killer applications incorporating social capabilities in highly interactive, expressive, and responsive applications.
This article introduces you to the architecture of applications built using the Flash and Facebook Platforms. It provides an overview of the different types of applications you can build and how the applications communicate with your server and Facebook.
Be sure to also read the article, The technologies for building applications on the Flash and Facebook Platforms.
You can build four types of Flash Platform applications to integrate with Facebook: applications on Facebook, external web applications, desktop applications, and mobile applications.
When a user requests an application on Facebook.com (for example, http://apps.facebook.com/someapp/), Facebook returns a Facebook web page with the Facebook chrome that contains an iFrame into which your application is loaded (see Figure 1).
As the user interacts with your application, several things may occur:
Now that we have covered the basics of non-Flash Platform applications on Facebook.com, let's take a look at integrating Flash Platform content into your application (see Figure 2).
Due to security restrictions of Flash Player, SWF files can only make data calls to the server from which the SWF file was served (that is, your server) or to servers that have a crossdomain policy file listing the server that the SWF file came from. This means that for your SWF file to make calls directly to the Facebook server, the Facebook server must have a crossdomain policy file giving SWF files from your server access. If you take a look at the Facebook cross-domain policy file, you will see a wildcard entry granting access to SWF files from all servers.
<cross-domain-policy> <site-control permitted-cross-domain-policies="master-only"/> <allow-access-from domain="*" secure="false"/> </cross-domain-policy>
Next, let's look at the architecture of Flash and Facebook Platform desktop applications (see Figure 4). Desktop applications are very similar to external Flash and Facebook Platform web applications, except that the SWF lives on the user's computer after the user installs the application and login is handled solely by the Adobe ActionScript 3 SDK for Facebook Platform. To deploy a Flash Platform application as desktop application, you create an AIR application for users to install.
Flash and Facebook mobile applications are like desktop applications; the application lives on the user's device after the user installs the application and login is handled solely by the Adobe ActionScript 3 SDK for Facebook Platform. On Android and Blackberry Tablet OS devices, the application is deployed as an AIR application (see Figure 5).
For deployment on iOS devices, the AIR application must be converted to a native iOS application using Flash Builder 4.5 or later or Flash Professional CS5 or later and then deployed (see Figure 6).
This article presented architecture diagrams and process flows for non-Flash Platform applications on Facebook.com, Flash Platform applications on Facebook.com, external Flash and Facebook Platform web applications, Flash and Facebook Platform desktop applications, and Flash and Facebook Platform mobile applications..
For detailed steps on creating a Flex and Facebook application that is deployed as either a desktop application, an external web application, or an application on Facebook.com, complete the tutorial series Create your first Flex and Facebook application.