Adobe Flash Builder for Force.com is an IDE developed jointly by Adobe and salesforce.com that gives developers a single, powerful tool for building Force.com Flex applications that are deployed to the desktop using the Adobe AIR runtime. (At this time, there is no way to build a web application with Flash Builder for Force.com though this should be possible in a future release.) The application you create is an AIR file that you distribute to your clients. The AIR runtime installs the AIR package on the client computer as a desktop application and renders the content and interacts with the operating system when the client runs the application.
Depending upon your background as a Force.com, Flex, AIR, or other developer, you may be familiar with some but not all of these technologies. The goal of this article is for all developers to understand all of the technologies behind building Force.com Flex applications with Flash Builder for Force.com.
The user experience when interacting with traditional web content created with HTML and JavaScript has changed dramatically over the last years, progressing from simple links and multiple, discrete pages to single-page "applications" with asynchronous data calls and interactive controls. The experience, however, is still limited by the objects that are available in the browser object model. This is where Flash Player steps in.
Adobe Flash Player is a browser plugin or Active X control that has a much richer object model and rendering engine that allows developers to include more highly expressive and interactive content in web applications. To include this richer content, you create you a SWF file (a compiled bytecode file that Flash Player can render) using some developer tool and then reference this SWF file in your HTML page. When the HTML page is parsed by the browser, the SWF file is downloaded and run by Flash Player in the browser window.
Adobe creates many tools for creating SWF files, including Flash Professional, Flash Builder (formerly Flex Builder), Flash Catalyst, and more. Each tool caters to different developer and designer skill sets. Adobe Flash Builder is an Eclipse-based development tool targeted at developers. With this IDE, you use the Flex framework to create SWF files. Flash Builder accelerates Flex application development by providing intelligent code hinting and generation, refactoring, compile-time error checking, interactive step-through debugging, and visual design for laying out and styling user interfaces.
Flex is a free, open source framework comprised of a library of ActionScript classes (ActionScript is the scripting language for the Flash Player) and executables to help you more quickly and easily develop, compile, and interactively debug applications. The Flex framework includes classes for over 100 extensible components, including UI controls (buttons, list boxes, sliders, steppers, data grids, charts, and more), containers (VGroup, HGroup, Panel, Form, and more to help you build adaptive application interfaces), managers (for styles, drag and drop, focus, popups, cursors, browser history and deep links, and more), remote procedure calls (HTTP request, web services, and remote objects), formatters, validators, and utilities.
You create Flex applications (SWF files built with Flex) using two languages: ActionScript and MXML. ActionScript is an inheritance based object-oriented scripting language based on the ECMAScript standard. MXML is a convenience language; it provides an alternate way to generate ActionScript using a declarative tag-based XML syntax. When you compile an application, the MXML is parsed and converted to ActionScript in memory and then the ActionScript is compiled into bytecode, your SWF file. Although you never have to use MXML, it is typically used to define application interfaces (for layouts, the MXML code is usually more succinct and understandable than the corresponding ActionScript would be) and ActionScript is used to write the application logic.
The rich Internet applications built with Flex run in the browser with Flash Player and have all the benefits of browser-based applications, including anywhere access, easy deployment (no installation necessary), simple updating, and consistency across all operating systems and browsers. They also have all the limitations of browser-based applications, including no offline access and the confines of the browser's security sandbox which keeps them from interacting with the user's computer outside the browser window.
In order to get the best of both worlds, Adobe introduced Adobe AIR, a cross-operating system runtime and set of tools that enable developers to deploy HTML, Ajax, and Flash Platform applications (SWF files) to the desktop. The Flash Platform is what Adobe calls its entire family of technologies used to create, run, and provide data to SWF files including the client runtimes, tools, frameworks, servers, and cloud services. An emerging design pattern for applications is to deliver a browser-based version for all users and a desktop version for more active or power users.
You can use Flash Builder to create both web and desktop applications with Flex. If you create both types of applications, you can also share code from separate library projects. When you compile a Flex application for the desktop, you get a SWF and an XML file (called the application descriptor file) which has information about things like what the container operating system window should look like, what icon should be used for the application on the client computer, and more.
During development, it would be inconvenient (to say the least) if you had to install the application on your computer every time you wanted to test it. Instead when you test an application, Flash Builder launches a tool called the AIR Debug Launcher (ADL), which allows you to run the application without installation. When ready to deploy, you use Flash Builder, which uses a tool called the ADT (AIR Development Tool) to create a release build consisting of an AIR package file, which includes the SWF file, the application descriptor file, assets, and more. This is the file you must distribute to your users. When you export, you must also associate a digital certificate from a trusted agency to sign the application since it will install on the user's computer with full permissions and have capabilities for interacting with their operating system. (Of course, you should only ever install trusted applications to minimize the chance they may contain any harmful code.)
In order to install an AIR application, users must have the AIR runtime installed which is the cross-operating system runtime used to install, manage, and run AIR applications. To provide a more seamless install experience for users so they can install the application from a web page (instead of having to to download and install the AIR runtime and then download and install the AIR application), Adobe provides a default HTML file and badge.swf file which provides a template for letting users click a badge (a framed customized image button) that checks and installs the runtime if necessary and then installs the AIR application. If you go the Adobe AIR Marketplace, you will see this is how all the applications are delivered.
Because AIR applications are running as desktop applications, they can interact with the user's file system and operating system clipboard and can create and modify menus, dock/tray icons, multiple operating system windows, and more. The Flex framework contains additional components and classes for adding these AIR specific functionalities to applications. The AIR runtime also includes the open source local SQLite database and Webkit browser engines so you can store data locally and include full HTML/JavaScript code or existing web pages in your AIR applications.
With that, you are now up to speed on Flash Player, SWF files, Flash Builder, Flex, ActionScript, MXML, AIR runtime, and AIR files. Next, let's take a look at integrating these rich applications built with Flex with Force.com.
Salesforce.com is a world leader in providing software as a service (SaaS) in which they host business software and companies purchase subscriptions to use it.
The software solution consists of a family of applications and pre-built database tables for you to store, view, and manipulate data. The application you use to access the data is usually a web application, but salesforce.com also provides mobile applications. The data is stored on servers maintained and managed by salesforce.com. This type of service is also referred to as cloud computing; the cloud is the Internet where all the applications and data live. Most prebuilt functionality for salesforce.com offerings is for customer relationship management (CRM) with tailored solutions for sales, service, marketing, small business, and so on. The applications and the database tables are highly customizable and security is role-based.
In addition to offering their software as a service, salesforce.com also offers their platform as a service (PaaS), called the Force.com platform. You buy subscriptions to the Force.com service exactly as for the CRM software as a service, but now developers also have access to a web service API to access the data so they can build their own applications that interact with salesforce.com data. The applications can be integrated into the main salesforce.com web application or be deployed as external web applications or desktop applications.
Typically, the hosted salesforce.com web applications are built using Apex (a proprietary Java-like programming language for the Force.com platform) and Visualforce (an XML-like syntax for building user interfaces in HTML or Ajax). As you have learned, though, you can create richer, more highly expressive and interactive applications using Flex and this is where Adobe Flash Builder for Force.com comes in.
Adobe Flash Builder for Force.com is an enhanced version of the Flash Builder IDE jointly developed by Adobe and salesforce.com for building Flex applications that interact with salesforce.com data. You must install it as a separate IDE; it cannot be installed as a plugin into existing Eclipse or Flash Builder instances. This Force.com version has all the normal Flash Builder functionality but adds a new project type (a Force.com Stratus project), a new type of data service (a salesforce.com data service), and a framework codenamed Stratus that helps you more quickly and easily create applications that interact with salesforce.com data.
Stratus is the codename for a framework comprised of a library of ActionScript classes to help you more easily retrieve, display, and edit salesforce.com data. Stratus builds on the client-side data management included in Adobe LiveCycle Data Services, but does not include the LCDS server-side data management functionality. The Stratus framework includes:
When you create a Force.com Stratus project in Flash Builder for Force.com, your project will already include these framework classes in its library folder.
The data management and synchronization functionality provided by the Stratus framework is made possible using two LCDS client-side libraries. These two libraries are part of the full LCDS product which includes not only client libraries but also server-side libraries to create real-time data collaboration applications - applications in which a user's data changes are "pushed" to the server but also to other applications using the same data so the users always see real-time or the most up-to-data. Applications built with Stratus do not provide this real-time data synchronization amongst clients which is provided with full LCDS, but instead use a polling mechanism in which the client and server are synced periodically (every 20 minutes by default) to see if any data changes have occurred that need to be committed to either the client or the server. For more information on how data is managed and moved between the client and server in applications created with the Stratus framework, read the Understanding data management in applications built with Adobe Flash Builder for Force.com article.
When you create a Force.com Stratus project with Flash Builder for Force.com, the LCDS client-side libraries are included in the project's library folder along with the Stratus framework code. These libraries are included for use only by the Stratus framework and are not for direct use by the developer. The use of these client-side LCDS libraries is provided as part of the Flash Builder for Force.com end user license for creating applications built with the Stratus framework and using the Force.com platform to connect to salesforce.com data. If you want to use these libraries for any other types of projects, you need to purchase an LCDS license.
Flash Builder for Force.com is an IDE for building Force.com Flex desktop applications, desktop applications rendered by the AIR runtime that interact with salesforce.com data. Flash Builder for Force.com is currently a developer preview release (Flash Builder itself is currently in beta 2) and is for you to get early hands-on experience building desktop applications that integrate with the Force.com cloud. It is subject to change, so you shouldn't rely on it for production. Also, remember that at this time you can only build desktop applications with Flash Builder for Force.com and not web applications, though this should be possible in a future release.
For additional information about Flash Builder for Force.com, go the Salesforce.com technology center in the Adobe Developer Connection or or the Adobe page on the Salesforce website.
For additional information about the Flash Platform, read the Flash Platform overview article or go the Flash Platform technology center.
For more information about salesforce.com and Force.com, go to salesforce.com and the Force.com developer center.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Jeanette Stallons is an independent Flex trainer and consultant who has taught for many companies including Adobe, Oracle, Boeing, Wachovia, Morgan Stanley, and Charles Schwab. Prior to working for herself, Jeanette worked at Allaire, Macromedia, and then Adobe in the training department, architecting, writing, teaching, and building applications for Flash, Flex, and other products. Her latest project is the Adobe Flex Learning Paths Flex application for which she was and continues to remain the idea behind, the programmer, and the content expert.