Datasheet

Luchner c01.tex V3 - 03/20/2008 2:29pm Page 6
Chapter 1: The Development Environment
<installFolder>AIRCMR/HelloWorld</installFolder>
<programMenuFolder>AIRCMR</programMenuFolder>
</application>
2. Save the file as
HelloWorld-app.xml
in the project directory you previously set up —
C:
\
Development
\
AIR
\
HelloWorld
or
/Development/AIR/HelloWorld
, Windows and Mac,
respectively. Create a new document and enter the following:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
windowComplete="completeHandler();">
<mx:Script>
<![CDATA[
// window has completed initial layout and is made visible.
private function completeHandler():void
{
}
]]>
</mx:Script>
<mx:Label text="Hello World" />
</mx:WindowedApplication>
3. Save the file as
HelloWorld.mxml
in the project directory along with
HelloWorld-app.xml
.
The first snippet, saved as
HelloWorld-app.xml
, is the descriptor file for the Hello World application.
Although the descriptor file is not needed to compile a SWF using the
amxmlc
compiler, it is neces-
sary for debugging and previewing, as well as packaging the application for installation. The descriptor
file specifies properties associated with the AIR application. It contains values that will be displayed
during installation, and data to be displayed by the operating system after installation. The descrip-
tor file also allows you to customize the appearance of the AIR application chrome — or visual display
window — within the
<initialWindow>
element node. The properties defined in this example are only
a subset of those available. Many are optional and have been left out. Subsequent chapters use them as
they pertain to the specific applications you will be building.
The
application
tag is the root tag for the application descriptor file. The
xmlns
attribute is the URI
reference for the AIR namespace. The last segment of the namespace (1.0) is the runtime version required
to run the AIR application. The required child elements of the root application tag are
id
,
filename
,
version
, and parent
initialWindow
. The value of the
id
element must be unique — meaning no two
AIR applications installed on your machine can share the same application ID. As such, best practice is
to use a dot-delimited reverse-DNS-style string as an identifier. Supported characters for
id
include 0–9,
az, AZ, dot, and hyphen. Any special characters (aside from dot and hyphen), including spaces, will
throw an Invalid Application error upon launch of the AIR application. For this example, the unique ID
is given the value
com.aircmr.HelloWorld
, as it relates to the examples found in the code for this chapter
on the accompanying website.
6