Hello World in AIR

The AIR SDK is free, so if you are willing to write code in Notepad (or your favorite text editor) and compile and build your applications using command-line tools either directly or hooked up to an IDE of your choice, you can certainly create AIR applications without having to purchase any additional software. In particular, AIR comes with the following tools:

ADL

The AIR Debug Launcher that you can use from a command line

ADT

The AIR Developer Tool with which you create deployable .air files

Most likely, you’ll work in the Flash Builder IDE, which includes the AIR project creation wizard. To get familiar with this method, try developing a HelloWorld application.

  1. Create a new Flex project called HelloWorld in Flash Builder.

  2. In the same window where you enter the project name, select the radio button titled “Desktop application (runs in Adobe AIR).” Click the Finish button to see a window similar to Figure 9-1.

  3. Instead of the familiar <mx:Application> tag, the root tag of an AIR application is <mx:WindowedApplication>. Add a line <mx:Label text="Hello World"> to the code and run this application. Figure 9-2 shows the results.

An empty template of the AIR application

Figure 9-1. An empty template of the AIR application

The src folder of your Flash Builder project now contains an application descriptor file called HelloWorld-app.xml. Example 9-1 shows a fragment of this file. (If you don’t use Flash Builder, you’ll ...

Get Agile Enterprise Application Development with Flex now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.