Datasheet

Luchner c01.tex V3 - 03/20/2008 2:29pm Page 5
Chapter 1: The Development Environment
Within this directory —
C:/Development/AIR
or
/Development/AIR
— will reside your AIR project sub-
directories. From here on, this will be referred to as the ‘‘development directory.’’
Your first project will create a simple Hello World application. There is nothing special about this appli-
cation and it will not involve much of the AIR API other than the
WindowedApplication
container. It is
intended to introduce you to compiling, debugging, and packaging your application.
Within your development directory, create a folder named
HelloWorld
. You need at least two files in
order to compile and deploy AIR applications:
A main le — This can be either an MXML (
.mxml
) or ActionScript (
.as
)file.
An application descriptor file using the XML markup
Most, if not all, of the examples found in this book have an MXML file as the application’s main file.
This is the file you will supply as the main file argument to the
amxmlc
compiler when it comes time to
compile. In the case of the Hello World application, this will be
HelloWorld.mxml
.
The naming convention for the project’s application descriptor file used throughout this book appends
the string
-app
to the project’s name, though you can name the file as you wish. In the case of the Hello
World application, the application descriptor file is named
HelloWorld-app.xml
. The generated SWF file
and the application descriptor will be used to deploy and preview your application prior to packaging. To
create an AIR installer, you will need a signed certificate, the generated SWF, the application descriptor
file, and any ancillary files required (such as graphics files).
Because the Flex and AIR command-line tools are available within the SDK you have installed, you are
not reliant on an IDE and can continue development by firing up your favorite text editor.
Code and Code Explanation
Open your favorite editor and create a new document. Then, complete the following steps:
1. Enter the following markup (alternatively, you can find this example in the code files for this
chapter on the accompanying website):
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.0">
<id>com.aircmr.HelloWorld</id>
<version>0.1</version>
<filename>HelloWorld</filename>
<name>Hello World</name>
<description>An AIR app to say Hello</description>
<initialWindow>
<content>HelloWorld.swf</content>
<title>Hello World</title>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
</initialWindow>
5