31.07.2013 Views

Building Adobe AIR Applications

Building Adobe AIR Applications

Building Adobe AIR Applications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING ADOBE <strong>AIR</strong> APPLICATIONS<br />

Creating your first <strong>AIR</strong> application<br />

adt -package -storetype pkcs12 -keystore sampleCert.pfx HelloWorld.air<br />

HelloWorld-app.xml HelloWorld.swf<br />

You will be prompted for the keystore file password. Type the password and press Enter. The password characters<br />

are not displayed for security reasons.<br />

The HelloWorld.air argument is the <strong>AIR</strong> file that ADT produces. HelloWorld-app.xml is the application descriptor<br />

file. The subsequent arguments are the files used by your application. This example only uses three files, but you<br />

can include any number of files and directories.<br />

After the <strong>AIR</strong> package is created, you can install and run the application by double-clicking the package file. You<br />

can also type the <strong>AIR</strong> filename as a command in a shell or command window.<br />

For more information, see “Packaging a desktop <strong>AIR</strong> installation file” on page 51.<br />

Creating your first <strong>AIR</strong> application for Android with the<br />

Flex SDK<br />

To begin, you must have installed and set up the <strong>AIR</strong> and Flex SDKs. This tutorial uses the AMXMLC compiler from<br />

the Flex SDK and the <strong>AIR</strong> Debug Launcher (ADL), and the <strong>AIR</strong> Developer Tool (ADT) from the <strong>AIR</strong> SDK. See “Setting<br />

up the Flex SDK” on page 18.<br />

You must also download and install the Android SDK from the Android website, as described in: Android Developers:<br />

Installing the SDK.<br />

Note: For information on iPhone development, see Creating a Hello World iPhone application with Flash Professional CS5.<br />

Create the <strong>AIR</strong> application descriptor file<br />

This section describes how to create the application descriptor, which is an XML file with the following structure:<br />

<br />

...<br />

...<br />

…<br />

<br />

…<br />

<br />

...<br />

<br />

1 Create an XML file named HelloWorld-app.xml and save it in the project directory.<br />

2 Add the element, including the <strong>AIR</strong> namespace attribute:<br />

The last segment of the namespace, “2.7,”<br />

specifies the version of the runtime required by the application.<br />

3 Add the element:<br />

samples.android.HelloWorld The application ID uniquely identifies your application along with the<br />

publisher ID (which <strong>AIR</strong> derives from the certificate used to sign the application package). The recommended form<br />

is a dot-delimited, reverse-DNS-style string, such as "com.company.AppName".<br />

4 Add the element:<br />

Last updated 7/8/2013<br />

39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!