Flash began life as a program for creating cool animations in files small enough to send over the Internet. Flash has evolved since then, gaining the ability to create interactive animations using ActionScript. During the same period, the Internet grew up, and the line between desktop applications and web-based services has blurred. The next step in Flash's evolution is the ability to create desktop applications. After all, not all computers are connected to the Internet all the time. Better still, desktop programs don't have the limitations of browser-based apps, which are, for safety's sake, restricted in the ways they can read and write to files on your computer.
And so Adobe developed the open-source AIR system for creating applications that run outside a web browser. AIR lets you develop powerful applications using your Flash and ActionScript skills, and do it quickly. This chapter introduces the concepts behind Adobe AIR and shows you how to create a bare-bones AIR application. You'll learn how to convert your existing Flash animations into an AIR desktop application. Throughout, you'll find tips explaining where you can learn more about AIR and how other developers are using it.
If you're interested in developing desktop applications or applets that can run on Windows, Mac, and even Linux computers, read on. AIR stands for Adobe Integrated Runtime. In programmer-speak, a runtime, sometimes called a runtime environment, works sort of like a translator. You can write a program in a relatively human language like ActionScript, and the runtime translates your code into the 1s and 0s that a PC understands. For example, you can display an object on a computer screen using ActionScript's addChild() method—one line of code. Flash Player (the runtime environment) pushes around a bunch of bits and bytes to manipulate specific pixels on the screen. The fact that Adobe has Flash Players for Windows, Mac, and Linux computers means you can write one Flash animation that plays everywhere. You don't have to worry about all the differences among those operating systems. Adobe's done that work for you. The same runtime concepts apply to AIR.
Like Flash Player, AIR is a runtime environment, but there are significant differences between AIR and Flash Player, making each suited for different types of projects. From the beginning, AIR was designed to let Flash designers and web developers use their expertise to build programs that run on computer desktops instead of browsers. Many AIR programs retrieve and store data on a web server, but they also have the ability to work with the local files on a computer in ways not available to a browser-based app. For example, eBay Desktop (Figure 21-1) is an AIR app that lives on the desktop and shuffles data stored on a web server when there's an Internet connection. But other AIR applications can browse through a computer's file system and then open a file in the associated application; Word docs in Word, and MP3s in media players. AIR applications can be designed to recognize when cameras, thumb drives, or other storage devices are connected or disconnected. You can use input from microphones in your AIR app to create audio notes or other features.
Figure 21-1. The eBay Desktop is an example of an AIR application. You install it to run like a desktop program, but it uses web-based data to give you real-time updates on auctions and other eBay services.
The Integrated part of the Adobe Integrated Runtime name comes from the fact that AIR was designed as an open-source system that gives developers the opportunity to use the skills they've already learned. It's not limited to Flash and ActionScript. If you're an HTML and JavaScript wizard, you can create an entire AIR application using those tools. If you're proficient in JavaScript and ActionScript, you can use a combination of those tools to build your app. Naturally, Adobe hopes you'll use its tools to create your apps, so you'll find AIR capabilities built into lots of its tools, not just Flash and Flex. For example, Dreamweaver and Fireworks have AIR capabilities, too.
Both AIR and Flash are available for Windows, Mac, and Linux computers, so you can focus on developing one great program and you don't have to sweat the details of different operating systems. In spite of that, there are many ways AIR applications and Flash animations differ. Here's a list of the main differences:
AIR uses the Adobe AIR runtime. Flash uses the Flash Player (also a runtime environment).
Most AIR applications run in a desktop window. Flash usually uses a browser window.
AIR programs can be developed using a combination of tools: Flash, Flex, HTML, XML, and JavaScript. Flash animations are most often developed using Flash Professional, Flash Builder, or Flex.
An AIR application must be installed on a computer like any other desktop application. Flash animations simply require that the Flash Player be present. According to Adobe, Flash Player is installed on well over 90 percent of computers.
Because it's installed on a computer like any old program, an AIR application requires a code signing certificate. This bit of security verifies the source of the program (see Create a Code Signing Certificate). Flash animations don't require a code signing certificate.
Want to see some snazzy examples of AIR programs? Go to www.adobe.com/products/air/. Near the bottom of the page, look for the link that says "Get AIR applications." That takes you to the Adobe AIR Marketplace (Figure 21-2) where apps are displayed, ranked, and acquired.
Figure 21-2. Taking a page from the iTunes App Store, Adobe created the AIR Marketplace, where developers can showcase and sell their creations. Want to learn what others are doing with AIR? Go to www.adobe.com/cfusion/marketplace/. Already have a finished AIR app? Maybe yours will make the Highest Rated or Most Popular lists.