If you have been developing applications with Flex, then a whole new world of possibility is about to be opened to you. Until now your Flex applications have probably been accessed over the web. This is a great model for many rich Internet applications. But what about applications that benefit from an existence outside of the browser? What happens when you want to create a custom application experience all the way down to the window chrome? What about when you need deep system integration like local file access, native drag-and-drop support, or system notification support? The Adobe AIR runtime was built exactly for these reasons. With Adobe AIR you can use the exact same tools, components, and programming model you are used to with Flex but you have a whole new set of APIs available to you.
Adobe AIR allows you to build Flex applications that are installed on a user's PC and run just like any other desktop application. The primary means for a user to install your AIR application is just to download the AIR runtime if they don't already have it and then to download and run your AIR app file from your web site, over e-mail, or over a network file share. You can also add an installer to your website which will detect whether or not the AIR runtime is installed on the client and, if necessary, install it before installing your application. The simplicity of AIR allows your users to have your applications installed and running within minutes.
When building applications on AIR you can continue to use Flex Builder and the free Flex SDK. The AIR SDK has been rolled into the new Flex 3 tools. Since AIR actually includes an enhanced version of Adobe Flash Player, which runs your applications in the browser, it will also run your Flex applications unmodified as AIR applications. However you probably will want to extend portions of your application in order to take advantage of the APIs that AIR provides.
Adobe AIR provides numerous new APIs and components that allow you to go way beyond what you can do in the browser. For example, AIR includes APIs that enable you to perform read and write operations on the local file systems. This can be a very important API for applications that need to go beyond the cumbersome upload and download paradigm.
Adobe AIR also includes a local embedded database that can be used to store data for offline use, caching, and so on. The API to perform CRUD (create, read, update, and delete) operations to the local database is extremely simple to use since the database is SQLite. This means you can write the same SQL you are already familiar with in order to interact with the local database.
Another great feature of AIR is that it includes the Webkit HTML rendering engine. With Flex applications in the browser you have to do strange iframe hacks in order to display complex HTML content within your Flex application. With AIR that hassle goes away since the HTML Flex component perfectly renders complex HTML as a Flash object. That object then obeys all the rules for measurement, styling, visibility, and so on that other Flex components obey. You can load HTML content either programmatically, from a local file, or from a remote web server. If the loaded HTML content includes JavaScript, that code will be executed just like it would within the browser. Similar to the Flex Ajax Bridge in the browser there is an ActionScript JavaScript bridge, which you can use in AIR to communicate between the loaded JavaScript and your applications ActionScript.
In order to support offline applications there is a Service Connectivity API that enables you to detect when your application goes offline or online. This helps you to know things like whether you can perform network operations, whether you should sync local changes to a remote server, or whether you should update a local cache.
Other AIR APIs which allow you to really build custom branded desktop application experiences include native drag-and-drop support, full right-click context menu control, system clipboard access, system notifications, and numerous ways to customize the appearance of your application windows.
You can already find numerous examples of Flex applications being built on AIR. One example is the eBay Desktop project, which is a full eBay desktop application. Power users of eBay prefer to have a powerful desktop application that works offline and has enhanced desktop application functionality as opposed to yet another tab in their browsers. eBay was able to easily build this new Flex-based application on AIR and create a complete custom user experience. The eBay Desktop application was built on top of their existing infrastructure of web services and HTML item descriptions.
E-mail clients such as the open source Meldware Communications Server from Buni.org is also a great example of how Adobe AIR allows you to have an extremely high level of reuse between desktop applications and web applications. Many users like to use webmail for their e-mail needs, but many others prefer the power of a desktop application. With Flex you can build both and not have to build it twice. In Adobe AIR an e-mail client can have complex HTML rendering, native drag-and-drop support, system notifications, and offline support. Adding this functionality into the Meldware e-mail client would not require a rewrite of the application but rather just a few simple modifications.
Salesforce.com developers also benefit by being able to take their Salesforce.com data and applications offline using the Flex Toolkit for Apex and Adobe AIR. The toolkit includes support for offline-cached queries in AIR as well as cached/delayed inserts. This means you can easily build applications in Flex that work on the web or on the desktop using one simple API.
Adobe AIR really does open a whole new world of possibilities for Flex developers. You are no longer bound to the constraints of the browser sandbox. With AIR you are free to build rich desktop experiences using the technologies and skills you already know.
For more information about Adobe AIR, visit the product page.
For more inspiration, check out the sample applications in the Adobe AIR Developer Center for Flex, Flash, and HTML/Ajax, as well as the Adobe AIR Developer Derby winners and the apps showcase.
To get started building Flex apps on AIR go to the Getting Started section of the Adobe AIR Developer Center for Flex or dig into Developing Adobe AIR applications with Adobe Flex. To dive right in and begin building AIR applications in Flex Builder, follow the simple steps in Developing AIR application with Flex on Adobe LiveDocs or explore popular Adobe AIR APIs by working with the AIR Quick Starts.
James Ward is a Technical Evangelist for Flex at Adobe and Adobe's JCP representative to JSR 286, 299, and 301. Much like his love for climbing mountains he enjoys programming because it provides endless new discoveries, elegant workarounds, summits and valleys. His adventures in climbing have taken him many places. Likewise, technology has brought him many adventures, including: Pascal and Assembly back in the early '90s; Perl, HTML, and JavaScript in the mid '90s; then Java and many of its frameworks beginning in the late '90s. Today he primarily uses Flex to build beautiful front ends for Java based back ends. Prior to working at Adobe, James built a rich marketing and customer service portal for Pillar Data Systems. James Ward's blog can be found at www.jamesward.org.