Macromedia Air - 2015 Instruction Manual

Building
ADOBE®
AIR® Applications

Legal notices

For legal notices, see http://help.adobe.com/en_US/legalnotices/index.html.
Last updated 12/7/2015

Contents

Chapter 1: About Adobe AIR
Chapter 2: Adobe AIR installation
Installing Adobe AIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Removing Adobe AIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Installing and running the AIR sample applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Adobe AIR updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Chapter 3: Working with the AIR APIs
AIR-specific ActionScript 3.0 classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Flash Player classes with AIR-specific functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
AIR-specific Flex components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 4: Adobe Flash Platform tools for AIR development
Installing the AIR SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Setting up the Flex SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Setting up external SDKs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
iii
Chapter 5: Creating your first AIR application
Creating your first desktop Flex AIR application in Flash Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Creating your first desktop AIR application using Flash Professional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Create your first AIR application for Android in Flash Professional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Creating your first AIR application for iOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Create your first HTML-based AIR application with Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Creating your first HTML-based AIR application with the AIR SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Creating your first desktop AIR application with the Flex SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Creating your first AIR application for Android with the Flex SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Chapter 6: Developing AIR applications for the desktop
Workflow for developing a desktop AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Setting desktop application properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Debugging a desktop AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Packaging a desktop AIR installation file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Packaging a desktop native installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Packaging a captive runtime bundle for desktop computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Distributing AIR packages for desktop computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Chapter 7: Developing AIR applications for mobile devices
Setting up your development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Mobile application design considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Workflow for creating AIR applications for mobile devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Setting mobile application properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Packaging a mobile AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Debugging a mobile AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Contents
Installing AIR and AIR applications on mobile devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Updating mobile AIR applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Use push notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Chapter 8: Developing AIR applications for television devices
AIR capabilities for TVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
AIR for TV application design considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Workflow for developing an AIR for TV application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
AIR for TV application descriptor properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Packaging an AIR for TV application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Debugging AIR for TV applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Chapter 9: Using native extensions for Adobe AIR
AIR Native Extension (ANE) files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Native extensions versus the NativeProcess ActionScript class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Native extensions versus ActionScript class libraries (SWC files) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Supported devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Supported device profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Task list for using a native extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Declaring the extension in your application descriptor file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Including the ANE file in your application’s library path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Packaging an application that uses native extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
iv
Chapter 10: ActionScript compilers
About the AIR command-line tools in the Flex SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Compiler setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Compiling MXML and ActionScript source files for AIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Compiling an AIR component or code library (Flex) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Chapter 11: AIR Debug Launcher (ADL)
ADL usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
ADL Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
ADL exit and error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Chapter 12: AIR Developer Tool (ADT)
ADT commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
ADT option sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
ADT error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
ADT environment variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 13: Signing AIR applications
Digitally signing an AIR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Creating an unsigned AIR intermediate file with ADT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Signing an AIR intermediate file with ADT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Signing an updated version of an AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Creating a self-signed certificate with ADT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Contents
Chapter 14: AIR application descriptor files
Application descriptor changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
The application descriptor file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
AIR application descriptor elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Chapter 15: Device profiles
Restricting target profiles in the application descriptor file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Capabilities of different profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Chapter 16: AIR.SWF in-browser API
Customizing the seamless install badge.swf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Using the badge.swf file to install an AIR application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Loading the air.swf file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Checking if the runtime is installed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Checking from a web page if an AIR application is installed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Installing an AIR application from the browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Launching an installed AIR application from the browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Chapter 17: Updating AIR applications
About updating applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Presenting a custom application update user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Downloading an AIR file to the user’s computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Checking to see if an application is running for the first time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Using the update framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
v
Chapter 18: Viewing Source Code
Loading, configuring, and opening the Source Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Source Viewer user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Chapter 19: Debugging with the AIR HTML Introspector
About the AIR Introspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Loading the AIR Introspector code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Inspecting an object in the Console tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Configuring the AIR Introspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
AIR Introspector interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Using the AIR Introspector with content in a non-application sandbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Chapter 20: Localizing AIR applications
Localizing the application name and description in the AIR application installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Localizing HTML content with the AIR HTML localization framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Chapter 21: Path environment variables
Setting the PATH on Linux and Mac OS using the Bash shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Setting the Path on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Last updated 12/7/2015

Chapter 1: About Adobe AIR

Adobe® AIR® is a multi-operating system, multi-screen runtime that allows you to leverage your web development skills to build and deploy rich Internet applications (RIAs) to the desktop and mobile devices. Desktop, television, and mobile AIR applications can be built with ActionScript 3.0 using Adobe® Flex and Adobe® Flash® (SWF based). Desktop AIR applications can also be built with HTML, JavaScript®, and Ajax (HTML based).
You can find more information about getting started with and using Adobe AIR at the Adobe AIR Developer Connection (
AIR enables you to work in familiar environments, to leverage the tools and approaches you find most comfortable. By supporting Flash, Flex, HTML, JavaScript, and Ajax, you can build the best possible experience that meets your needs.
For example, applications can be developed using one or a combination of the following technologies:
Flash / Flex / ActionScript
HTML / JavaScript / CSS / Ajax
Users interact with AIR applications in the same way that they interact with native applications. The runtime is installed once on the user's computer or device, and then AIR applications are installed and run just like any other desktop application. (On iOS, a separate AIR runtime is not installed; each iOS AIR app is a stand-alone application.)
http://www.adobe.com/devnet/air/).
1
The runtime provides a consistent cross-operating system platform and framework for deploying applications and therefore eliminates cross-browser testing by ensuring consistent functionality and interactions across desktops. Instead of developing for a specific operating system, you target the runtime, which has the following benefits:
Applications developed for AIR run across multiple operating systems without any additional work by you. The
runtime ensures consistent and predictable presentation and interactions across all the operating systems supported by AIR.
Applications can be built faster by enabling you to leverage existing web technologies and design patterns. You can
extend web-based applications to the desktop without learning traditional desktop development technologies or the complexity of native code.
Application development is easier than using lower-level languages such as C and C++. You do not need to manage
the complex, low-level APIs specific to each operating system.
When developing applications for AIR, you can leverage a rich set of frameworks and APIs:
APIs specific to AIR provided by the runtime and the AIR framework
ActionScript APIs used in SWF files and Flex framework (as well as other ActionScript based libraries and
frameworks)
HTML, CSS, and JavaScript
Most Ajax frameworks
Native extensions for Adobe AIR, which provide ActionScript APIs that provide you access to platform-specific
functionality programmed in native code. Native extensions can also provide access to legacy native code, and native code that provides higher performance.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
About Adobe AIR
AIR dramatically changes how applications can be created, deployed, and experienced. You gain more creative control and can extend your Flash, Flex, HTML, and Ajax-based applications to the desktop, mobile devices, and televisions.
For information about what is included in each new AIR update, see the Adobe AIR Release Notes
http://www.adobe.com/go/learn_air_relnotes_en).
(
2
Last updated 12/7/2015

Chapter 2: Adobe AIR installation

The Adobe® AIR® runtime allows you to run AIR applications. You can install the runtime in the following ways:
By installing the runtime separately (without also installing an AIR application)
By installing an AIR application for the first time through a web page installation “badge” (you are prompted to
also install the runtime)
By creating a custom installer that installs both your application and the runtime. You must get approval from
Adobe to distribute the AIR runtime in this fashion. You can request approval on the page. Note that Adobe does not provide tools for building such an installer. Many third-party installer toolkits are available, however.
By installing an AIR application that bundles AIR as a captive runtime. A captive runtime is used only by the
bundling application. It is not used to run other AIR applications. Bundling the runtime is an option on Mac and Windows. On iOS, all applications include a bundled runtime. As of AIR 3.7, all Android applications include a bundled runtime by default (although you have the option of using a separate runtime).
By setting up an AIR development environment such as the AIR SDK, Adobe® Flash® Builder™ , or the Adobe Flex®
SDK (which includes the AIR command line development tools). The runtime included in the SDK is only used when debugging applications — it is not used to run installed AIR applications.
The system requirements for installing AIR and running AIR applications are detailed here: Adobe AIR: System
requirements (http://www.adobe.com/products/air/systemreqs/).
Adobe runtime licensing
3
Both the runtime installer and the AIR application installer create log files when they install, update, or remove AIR applications or the AIR runtime itself. You can consult these logs to help determine the cause of any installation problems. See
Installation logs.

Installing Adobe AIR

To install or update the runtime, a user must have administrative privileges for the computer.
Install the runtime on a Windows computer
1 Download the runtime installation file from http://get.adobe.com/air.
2 Double-click the runtime installation file.
3 In the installation window, follow the prompts to complete the installation.
Install the runtime on a Mac computer
1 Download the runtime installation file from http://get.adobe.com/air.
2 Double-click runtime installation file.
3 In the installation window, follow the prompts to complete the installation.
4 If the Installer displays an Authenticate window, enter your Mac OS user name and password.
Install the runtime on a Linux computer
Note: At this time, AIR 2.7 and later are not supported on Linux. AIR applications deployed to Linux should continue to use the AIR 2.6 SDK.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Adobe AIR installation
Using the binary installer:
1 Locate the installation binary file from http://kb2.adobe.com/cps/853/cpsid_85304.html and download.
2 Set the file permissions so that the installer application can be executed. From a command line, you can set the file
permissions with:
chmod +x AdobeAIRInstaller.bin
Some versions of Linux allow you to set the file permissions on the Properties dialog opened through a context menu.
3 Run the installer from the command line or by double-clicking the runtime installation file.
4 In the installation window, follow the prompts to complete the installation.
Adobe AIR is installed as a native package. In other words, as rpm on an rpm based distribution and deb on a Debian distribution. Currently AIR does not support any other package format.
Using the package installers:
1 Locate the AIR package file from http://kb2.adobe.com/cps/853/cpsid_85304.html. Download the rpm or Debian
package, depending on which package format your system supports.
2 If needed, double-click AIR package file to install the package.
You can also install from the command line:
4
a On a Debian system:
sudo dpkg -i <path to the package>/adobeair-2.0.0.xxxxx.deb
b On an rpm-based system:
sudo rpm -i <path to the package>/adobeair-2.0.0-xxxxx.i386.rpm
Or, if you are updating an existing version (AIR 1.5.3 or later):
sudo rpm -U <path to the package>/adobeair-2.0.0-xxxxx.i386.rpm
Installing AIR 2 and AIR applications requires you to have administrator privileges on your computer.
Adobe AIR is installed to the following location: /opt/Adobe AIR/Versions/1.0
AIR registers the mime-type "application/vnd.adobe.air-application-installer-package+zip", which means that .air files are of this mime-type and are therefore registered with the AIR runtime.
Install the runtime on an Android device
You can install the latest release of the AIR runtime from the Android Market.
You can install development versions of the AIR runtime from a link on a web page or by using the ADT -
installRuntime command. Only one version of the AIR runtime can be installed at a time; you cannot have both a
release and a development version installed.
See “ADT installRuntime command” on page 169 for more information.
Install the runtime on an iOS device
The necessary AIR runtime code is bundled with each application created for iPhone, iTouch, and iPad devices. You do not install a separate runtime component.
More Help topics
AIR for iOS” on page 67
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Adobe AIR installation

Removing Adobe AIR

Once you have installed the runtime, you can remove it using the following procedures.
Remove the runtime on a Windows computer
1 In the Windows Start menu, select Settings > Control Panel.
2 Open the Programs, Programs and Features, or Add or Remove Programs control panel (depending on which
version of Windows you are running).
3 Select “Adobe AIR” to remove the runtime.
4 Click the Change/Remove button.
Remove the runtime on a Mac computer
Double-click the “Adobe AIR Uninstaller”, which is located in the /Applications/Utilities folder.
Remove the runtime on a Linux computer
Do one of the following:
Select the “Adobe AIR Uninstaller” command from the Applications menu.
Run the AIR installer binary with the -uninstall option
Remove the AIR packages (adobeair and adobecerts) with your package manager.
5
Remove the runtime from an Android device
1 Open the Settings app on the device.
2 Tap the Adobe AIR entry under Applications > Manage Applications.
3 Tap the Uninstall button.
You can also use the ADT -uninstallRuntime command. See “ADT uninstallRuntime command” on page 170 for more information.
Remove a bundled runtime
To remove a captive bundled runtime, you must remove the application it is installed with. Note that captive runtimes are only used to run the installing application.

Installing and running the AIR sample applications

To install or update an AIR application, a user must have administrative privileges for the computer.
Some sample applications are available that demonstrate AIR features. You can access and install them using the following instructions:
1 Download and run the AIR sample applications. The compiled applications as well as the source code are available.
2 To download and run a sample application, click the sample application Install Now button. You are prompted to
install and run the application.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Adobe AIR installation
3 If you choose to download sample applications and run them later, select the download links. You can run AIR
applications at any time by:
On Windows, double-clicking the application icon on the desktop or selecting it from the Windows Start menu.
On Mac OS, double-clicking the application icon, which is installed in the Applications folder of your user
directory (for example, in Macintosh HD/Users/JoeUser/Applications/) by default.
Note: Check the AIR release notes for updates to these instructions, which are located here:
http://www.adobe.com/go/learn_air_relnotes.

Adobe AIR updates

Periodically, Adobe updates Adobe AIR with new features or fixes to minor problems. The Automatic Notification and Update feature allows Adobe to automatically notify users when an updated version of Adobe AIR is available.
Updates to Adobe AIR ensure that Adobe AIR works properly and often contain important changes to security. Adobe recommends that users update to the latest version of Adobe AIR whenever a new version is available, especially when a security update is mentioned.
By default, when an AIR application is launched, the runtime checks if an update is available. It performs this check if it has been more than two weeks since the last update check. If an update is available, AIR downloads the update in the background.
6
Users can disable the auto-update capability by using the AIR SettingsManager application. The AIR SettingsManager application is available for download at
http://airdownload.adobe.com/air/applications/SettingsManager/SettingsManager.air.
The normal installation process for Adobe AIR includes connecting to http://airinstall.adobe.com to send basic information about the installation environment such as operating system version and language. This information is only transmitted once per installation and it allows Adobe to confirm that the installation was successful. No personally identifiable information is collected or transmitted.
Updating captive runtimes
If you distribute your application with a captive runtime bundle, the captive runtime is not updated automatically. For the security of your users, you must monitor the updates published by Adobe and update your application with the new runtime version when a relevant security change is published.
Last updated 12/7/2015

Chapter 3: Working with the AIR APIs

Adobe® AIR® includes functionality that is not available to SWF content running in Adobe® Flash® Player.
ActionScript 3.0 Developers
The Adobe AIR APIs are documented in the following two books:
ActionScript 3.0 Developer's Guide
ActionScript 3.0 Reference for the Adobe Flash Platform
HTML Developers
If you’re building HTML-based AIR applications, the APIs that are available to you in JavaScript via the AIRAliases.js file (see
Accessing AIR API classes from JavaScript) are documented in the following two books:
HTML Developer's Guide for Adobe AIR
Adobe AIR API Reference for HTML Developers
7

AIR-specific ActionScript 3.0 classes

The following table contains runtime classes are specific to Adobe AIR. They are not available to SWF content running in Adobe® Flash® Player in the browser.
HTML Developers
The classes that are available to you in JavaScript via the AIRAliases.js file are listed in Adobe AIR API Reference for
HTML Developers.
Class ActionScript 3.0 Package Added in AIR version
ARecord flash.net.dns 2.0
AAAARecord flash.net.dns 2.0
ApplicationUpdater air.update 1.5
ApplicationUpdaterUI air.update 1.5
AudioPlaybackMode flash.media 3.0
AutoCapitalize flash.text 3.0
BrowserInvokeEvent flash.events 1.0
CameraPosition flash.media 3.0
CameraRoll flash.media 2.0
CameraRollBrowseOptions flash.media 3.0
CameraUI flash.media 2.5
CertificateStatus flash.security 2.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Class ActionScript 3.0 Package Added in AIR version
CompressionAlgorithm flash.utils 1.0
DatagramSocket flash.net 2.0
DatagramSocketDataEvent flash.events 2.0
DNSResolver flash.net.dns 2.0
DNSResolverEvent flash.events 2.0
DockIcon flash.desktop 1.0
DownloadErrorEvent air.update.events 1.5
DRMAuthenticateEvent flash.events 1.0
DRMDeviceGroup flash.net.drm 3.0
DRMDeviceGroupErrorEvent flash.net.drm 3.0
DRMDeviceGroupEvent flash.net.drm 3.0
DRMManagerError flash.errors 1.5
EncryptedLocalStore flash.data 1.0
8
ExtensionContext flash.external 2.5
File flash.filesystem 1.0
FileListEvent flash.events 1.0
FileMode flash.filesystem 1.0
FileStream flash.filesystem 1.0
FocusDirection flash.display 1.0
GameInput flash.ui 3.0
GameInputControl flash.ui 3.0
GameInputControlType flash.ui 3.6 and earlier; dropped, as of 3.7
GameInputDevice flash.ui 3.0
GameInputEvent flash.ui 3.0
GameInputFinger flash.ui 3.6 and earlier; dropped, as of 3.7
GameInputHand flash.ui 3.6 and earlier; dropped, as of 3.7
Geolocation flash.sensors 2.0
GeolocationEvent flash.events 2.0
HTMLHistoryItem flash.html 1.0
HTMLHost flash.html 1.0
HTMLLoader flash.html 1.0
HTMLPDFCapability flash.html 1.0
HTMLSWFCapabiltiy flash.html 2.0
HTMLUncaughtScriptExceptionEvent flash.events 1.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Class ActionScript 3.0 Package Added in AIR version
HTMLWindowCreateOptions flash.html 1.0
Icon flash.desktop 1.0
IFilePromise flash.desktop 2.0
ImageDecodingPolicy flash.system 2.6
InteractiveIcon flash.desktop 1.0
InterfaceAddress flash.net 2.0
InvokeEvent flash.events 1.0
InvokeEventReason flash.desktop 1.5.1
IPVersion flash.net 2.0
IURIDereferencer flash.security 1.0
LocationChangeEvent flash.events 2.5
MediaEvent flash.events 2.5
MediaPromise flash.media 2.5
9
MediaType flash.media 2.5
MXRecord flash.net.dns 2.0
NativeApplication flash.desktop 1.0
NativeDragActions flash.desktop 1.0
NativeDragEvent flash.events 1.0
NativeDragManager flash.desktop 1.0
NativeDragOptions flash.desktop 1.0
NativeMenu flash.display 1.0
NativeMenuItem flash.display 1.0
NativeProcess flash.desktop 2.0
NativeProcessExitEvent flash.events 2.0
NativeProcessStartupInfo flash.desktop 2.0
NativeWindow flash.display 1.0
NativeWindowBoundsEvent flash.events 1.0
NativeWindowDisplayState flash.display 1.0
NativeWindowDisplayStateEvent flash.events 1.0
NativeWindowInitOptions flash.display 1.0
NativeWindowRenderMode flash.display 3.0
NativeWindowResize flash.display 1.0
NativeWindowSystemChrome flash.display 1.0
NativeWindowType flash.display 1.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Class ActionScript 3.0 Package Added in AIR version
NetworkInfo flash.net 2.0
NetworkInterface flash.net 2.0
NotificationType flash.desktop 1.0
OutputProgressEvent flash.events 1.0
PaperSize flash.printing 2.0
PrintMethod flash.printing 2.0
PrintUIOptions flash.printing 2.0
PTRRecord flash.net.dns 2.0
ReferencesValidationSetting flash.security 1.0
ResourceRecord flash.net.dns 2.0
RevocationCheckSettings flash.security 1.0
Screen flash.display 1.0
ScreenMouseEvent flash.events 1.0
10
SecureSocket flash.net 2.0
SecureSocketMonitor air.net 2.0
ServerSocket flash.net 2.0
ServerSocketConnectEvent flash.events 2.0
ServiceMonitor air.net 1.0
SignatureStatus flash.security 1.0
SignerTrustSettings flash.security 1.0
SocketMonitor air.net 1.0
SoftKeyboardType flash.text 3.0
SQLCollationType flash.data 1.0
SQLColumnNameStyle flash.data 1.0
SQLColumnSchema flash.data 1.0
SQLConnection flash.data 1.0
SQLError flash.errors 1.0
SQLErrorEvent flash.events 1.0
SQLErrorOperation flash.errors 1.0
SQLEvent flash.events 1.0
SQLIndexSchema flash.data 1.0
SQLMode flash.data 1.0
SQLResult flash.data 1.0
SQLSchema flash.data 1.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Class ActionScript 3.0 Package Added in AIR version
SQLSchemaResult flash.data 1.0
SQLStatement flash.data 1.0
SQLTableSchema flash.data 1.0
SQLTransactionLockType flash.data 1.0
SQLTriggerSchema flash.data 1.0
SQLUpdateEvent flash.events 1.0
SQLViewSchema flash.data 1.0
SRVRecord flash.net.dns 2.0
StageAspectRatio flash.display 2.0
StageOrientation flash.display 2.0
StageOrientationEvent flash.events 2.0
StageText flash.text 3.0
StageTextInitOptions flash.text 3.0
11
StageWebView flash.media 2.5
StatusFileUpdateErrorEvent air.update.events 1.5
StatusFileUpdateEvent air.update.events 1.5
StatusUpdateErrorEvent air.update.events 1.5
StatusUpdateEvent air.update.events 1.5
StorageVolume flash.filesystem 2.0
StorageVolumeChangeEvent flash.events 2.0
StorageVolumeInfo flash.filesystem 2.0
SystemIdleMode flash.desktop 2.0
SystemTrayIcon flash.desktop 1.0
TouchEventIntent flash.events 3.0
UpdateEvent air.update.events 1.5
Updater flash.desktop 1.0
URLFilePromise air.desktop 2.0
URLMonitor air.net 1.0
URLRequestDefaults flash.net 1.0
XMLSignatureValidator flash.security 1.0

Flash Player classes with AIR-specific functionality

The following classes are available to SWF content running in the browser, but AIR provides additional properties or methods:
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Package Class Property, method, or event Added in AIR version
flash.desktop Clipboard supportsFilePromise 2.0
ClipboardFormats BITMAP_FORMAT 1.0
FILE_LIST_FORMAT 1.0
FILE_PROMISE_LIST_FORMAT 2.0
URL_FORMAT 1.0
flash.display LoaderInfo childSandboxBridge 1.0
parentSandboxBridge 1.0
Stage assignFocus() 1.0
autoOrients 2.0
deviceOrientation 2.0
nativeWindow 1.0
orientation 2.0
orientationChange event 2.0
12
orientationChanging event 2.0
setAspectRatio 2.0
setOrientation 2.0
softKeyboardRect 2.6
supportedOrientations 2.6
supportsOrientationChange 2.0
NativeWindow owner 2.6
listOwnedWindows 2.6
NativeWindowInitOptions owner 2.6
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Package Class Property, method, or event Added in AIR version
flash.events Event CLOSING 1.0
DISPLAYING 1.0
PREPARING 2.6
EXITING 1.0
HTML_BOUNDS_CHANGE 1.0
HTML_DOM_INITIALIZE 1.0
HTML_RENDER 1.0
LOCATION_CHANGE 1.0
NETWORK_CHANGE 1.0
STANDARD_ERROR_CLOSE 2.0
STANDARD_INPUT_CLOSE 2.0
STANDARD_OUTPUT_CLOSE 2.0
USER_IDLE 1.0
13
USER_PRESENT 1.0
HTTPStatusEvent HTTP_RESPONSE_STATUS 1.0
responseHeaders 1.0
responseURL 1.0
KeyboardEvent commandKey 1.0
controlKey 1.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Package Class Property, method, or event Added in AIR version
flash.net FileReference extension 1.0
httpResponseStatus event 1.0
uploadUnencoded() 1.0
NetStream drmAuthenticate event 1.0
onDRMContentData event 1.5
preloadEmbeddedData() 1.5
resetDRMVouchers() 1.0
14
setDRMAuthenticationCredent ials()
1.0
URLRequest authenticate 1.0
cacheResponse 1.0
followRedirects 1.0
idleTimeout 2.0
manageCookies 1.0
useCache 1.0
userAgent 1.0
URLStream httpResponseStatus event 1.0
flash.printing PrintJob active 2.0
copies 2.0
firstPage 2.0
isColor 2.0
jobName 2.0
lastPage 2.0
maxPixelsPerInch 2.0
paperArea 2.0
printableArea 2.0
printer 2.0
printers 2.0
selectPaperSize() 2.0
showPageSetupDialog() 2.0
start2() 2.0
supportsPageSetupDialog 2.0
terminate() 2.0
PrintJobOptions pixelsPerInch 2.0
printMethod 2.0
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Working with the AIR APIs
Package Class Property, method, or event Added in AIR version
flash.system Capabilities languages 1.1
LoaderContext allowLoadBytesCodeExecution 1.0
Security APPLICATION 1.0
flash.ui KeyLocation D_PAD 2.5
Most of these new properties and methods are available only to content in the AIR application security sandbox. However, the new members in the URLRequest classes are also available to content running in other sandboxes.
The ByteArray.compress() and ByteArray.uncompress() methods each include a new algorithm parameter, allowing you to choose between deflate and zlib compression. This parameter is available only to content running in AIR.

AIR-specific Flex components

The following Adobe® Flex™ MX components are available when developing content for Adobe AIR:
FileEvent
FileSystemComboBox
FileSystemDataGrid
FileSystemEnumerationMode
FileSystemHistoryButton
FileSystemList
FileSystemSizeDisplayMode
FileSystemTree
FlexNativeMenu
HTML
Window
WindowedApplication
WindowedSystemManager
Additionally, Flex 4 includes the following spark AIR components:
15
Window
WindowedApplication
For more information about the AIR Flex components, see Using the Flex AIR components.
Last updated 12/7/2015

Chapter 4: Adobe Flash Platform tools for AIR development

You can develop AIR applications with the following Adobe Flash Platform development tools.
For ActionScript 3.0 (Flash and Flex) developers:
Adobe Flash Professional (see Publishing for AIR)
Adobe Flex 3.x and 4.x SDKs (see “Setting up the Flex SDK” on page 18 and “AIR Developer Tool (ADT)” on
page 158)
Adobe Flash Builder (see Developing AIR Applications with Flash Builder)
For HTML and Ajax developers:
Adobe AIR SDK (see “Installing the AIR SDK” on page 16 and “AIR Developer Tool (ADT)” on page 158)
Adobe Dreamweaver CS3, CS4, CS5 (see AIR Extension for Dreamweaver)
16

Installing the AIR SDK

The Adobe AIR SDK contains the following command-line tools that you use to launch and package applications:
AIR Debug Launcher (ADL) Allows you to run AIR applications without having to first install them. See “AIR Debug
Launcher (ADL)” on page 152.
AIR Development Tool (ADT) Packages AIR applications into distributable installation packages. See “AIR Developer
Tool (ADT)” on page 158.
The AIR command-line tools require Java to be installed your computer. You can use the Java virtual machine from either the JRE or the JDK (version 1.5 or newer). The Java JRE and the Java JDK are available at http://java.sun.com/.
At least 2GB of computer memory is required to run the ADT tool.
Note: Java is not required for end users to run AIR applications.
For a quick overview of building an AIR application with the AIR SDK, see “Creating your first HTML-based AIR
application with the AIR SDK” on page 31.

Download and install the AIR SDK

You can download and install the AIR SDK using the following instructions:
Install the AIR SDK in Windows
Download the AIR SDK installation file.
The AIR SDK is distributed as a standard file archive. To install AIR, extract the contents of the SDK to a folder on
your computer (for example: C:\Program Files\Adobe\AIRSDK or C:\AIRSDK).
The ADL and ADT tools are contained in the bin folder in the AIR SDK; add the path to this folder to your PATH
environment variable.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Adobe Flash Platform tools for AIR development
Install the AIR SDK in Mac OS X
Download the AIR SDK installation file.
The AIR SDK is distributed as a standard file archive. To install AIR, extract the contents of the SDK to a folder on
your computer (for example: /Users/<userName>/Applications/AIRSDK).
The ADL and ADT tools are contained in the bin folder in the AIR SDK; add the path to this folder to your PATH
environment variable.
Install the AIR SDK in Linux
The SDK is available in tbz2 format.
To install the SDK, create a folder in which you want to unzip the SDK, then use the following command: tar -jxvf
<path to AIR-SDK.tbz2>
For information about getting started using the AIR SDK tools, see Creating an AIR application using the command­line tools.

What's included in the AIR SDK

The following table describes the purpose of the files contained in the AIR SDK:
17
SDK folder Files/tools description
bin The AIR Debug Launcher (ADL) allows you to run an AIR application without first
frameworks The libs directory contains code libraries for use in AIR applications.
include The include directory contains the C-language header file for writing native
install The install directory contains the Windows USB drivers for Android devices. (These
lib Contains support code for the AIR SDK tools.
runtimes The AIR runtimes for the desktop and for mobile devices.
samples This folder contains a sample application descriptor file, a sample of the seamless
packaging and installing it. For information about using this tool, see
Launcher (ADL)” on page 152.
The AIR Developer Tool (ADT) packages your application as an AIR file for distribution. For information about using this tool, see
The projects directory contains the code for the compiled SWF and SWC libraries.
extensions.
are the drivers provided by Google in the Android SDK.)
The desktop runtime is used by ADL to launch your AIR applications before they have been packaged or installed.
The AIR runtimes for Android (APK packages) can be installed on Android devices or emulators for development and testing. Separate APK packages are used for devices and emulators. (The public AIR runtime for Android is available from the Android Market.)
install feature (badge.swf), and the default AIR application icons.
AIR Developer Tool (ADT)” on page 158.
AIR Debug
templates descriptor-template.xml - A template of the application descriptor file, which is
required for each AIR application. For a detailed description of the application descriptor file, see
Schema files for the XML structure of the application descriptor for each release version of AIR are also found in this folder.
AIR application descriptor files” on page 195.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Adobe Flash Platform tools for AIR development

Setting up the Flex SDK

To develop Adobe® AIR® applications with Adobe® Flex™, you have the following options:
You can download and install Adobe® Flash® Builder™, which provides integrated tools to create Adobe AIR projects
and test, debug, and package your AIR applications. See
Builder” on page 19.
You can download the Adobe® Flex™ SDK and develop Flex AIR applications using your favorite text editor and the
command-line tools.
For a quick overview of building an AIR application with Flex SDK, see “Creating your first desktop AIR application
with the Flex SDK” on page 35.

Install the Flex SDK

Building AIR applications with the command-line tools requires that Java is installed on your computer. You can use the Java virtual machine from either the JRE or the JDK (version 1.5 or newer). The Java JRE and JDK are available at http://java.sun.com/.
Note: Java is not required for end users to run AIR applications.
Creating your first desktop Flex AIR application in Flash
18
The Flex SDK provides you with the AIR API and command-line tools that you use to package, compile, and debug your AIR applications.
1 If you haven't already done so, download the Flex SDK at
http://opensource.adobe.com/wiki/display/flexsdk/Downloads.
2 Place the contents of the SDK into a folder (for example, Flex SDK).
3 Copy the contents of the AIR SDK over the files in the Flex SDK.
Note: On Mac computers, make sure that you copy or replace the individual files in the SDK folders — not entire directories. By default, copying a directory on the Mac to a directory of the same name removes the existing files in the target directory; it does not merge the contents of the two directories. You can use the window to merge the AIR SDK into the Flex SDK:
4 The command-line AIR utilities are located in the bin folder.
ditto air_sdk_folder flex_sdk_folder
ditto command in a terminal

Setting up external SDKs

Developing applications for Android and iOS requires that you download provisioning files, SDKs or other development tools from the platform makers.
For information about downloading and installing the Android SDK, see Android Developers: Installing the SDK. As of AIR 2.6, you are not required to download the Android SDK. The AIR SDK now includes the basic components needed to install and launch APK packages. Still, the Android SDK can be useful for a variety of development tasks, including creating and running software emulators and taking device screenshots.
An external SDK is not required for iOS development. However, special certificates and provisioning profiles are needed. For more information, see
Obtaining developer files from Apple.
Last updated 12/7/2015

Chapter 5: Creating your first AIR application

Creating your first desktop Flex AIR application in Flash Builder

For a quick, hands-on illustration of how Adobe® AIR® works, use these instructions to create and package a simple SWF file-based AIR “Hello World” application using Adobe® Flash® Builder.
If you haven’t already done so, download and install Flash Builder. Also, download and install the most recent version of Adobe AIR, which is located here:

Create an AIR project

Flash Builder includes tools to develop and package AIR applications.
www.adobe.com/go/air.
19
You begin to create AIR applications in Flash Builder or Flex Builder in the same way that you create other Flex-based application projects: by defining a new project.
1 Open Flash Builder.
2 Select File > New > Flex Project.
3 Enter the project name as AIRHelloWorld.
4 In Flex, AIR applications are considered an application type. You have two type options:
a web application that runs in Adobe® Flash® Player
a desktop application that runs in Adobe AIR
Select Desktop as the application type.
5 Click Finish to create the project.
AIR projects initially consist of two files: the main MXML file and an application XML file (known as the application descriptor file). The latter file specifies application properties.
For more information, see Developing AIR applications with Flash Builder.

Write the AIR application code

To write the “Hello World” application code, you edit the application MXML file (AIRHelloWorld.mxml), which is open in the editor. (If the file isn't open, use the Project Navigator to open the file.)
Flex AIR applications on the desktop are contained within the MXML WindowedApplication tag. The MXML WindowedApplication tag creates a simple window that includes basic window controls such as a title bar and close button.
1 Add a title attribute to the WindowedApplication component, and assign it the value "Hello World":
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" title="Hello World">
</s:WindowedApplication>
2 Add a Label component to the application (place it inside the WindowedApplication tag). Set the text property of
the Label component to
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
<s:Label text="Hello AIR" horizontalCenter="0" verticalCenter="0"/>
</s:WindowedApplication>
"Hello AIR", and set the layout constraints to keep it centered, as shown here:
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" title="Hello World">
3 Add the following style block immediately after the opening WindowedApplication tag and before the label
component tag you just entered:
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark"; s|WindowedApplication {
skinClass:ClassReference("spark.skins.spark.SparkChromeWindowedApplicationSkin");
background-color:#999999; background-alpha:"0.7";
}
</fx:Style>
20
These style settings apply to the entire application and render the window background a slightly transparent gray.
The application code now looks like the following:
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" title="Hello World">
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark"; s|WindowedApplication {
skinClass:ClassReference("spark.skins.spark.SparkChromeWindowedApplicationSkin");
background-color:#999999; background-alpha:"0.7";
}
</fx:Style>
<s:Label text="Hello AIR" horizontalCenter="0" verticalCenter="0"/>
</s:WindowedApplication>
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application
Next, you will change some settings in the application descriptor to allow the application to be transparent:
1 In the Flex Navigator pane, locate the application descriptor file in the source directory of the project. If you named
your project AIRHelloWorld, this file is named AIRHelloWorld-app.xml.
2 Double-click the application descriptor file to edit it in Flash Builder.
3 In the XML code, locate the commented lines for the systemChrome and transparent properties (of the
initialWindow property). Remove the comments. (Remove the "<!--" and "-->" comment delimiters.)
4 Set the text value of the systemChrome property to none, as in the following:
<systemChrome>none</systemChrome>
5 Set the text value of the transparent property to true, as in the following:
<transparent>true</transparent>
6 Save the file.

Test the AIR application

To test the application code that you’ve written, run it in debug mode.
1 Click the Debug button in the main toolbar.
You can also select the Run > Debug > AIRHelloWorld command.
21
The resulting AIR application should look like the following example:
2 Using the horizontalCenter and verticalCenter properties of the Label control, the text is placed in the center
of the window. Move or resize the window as you would any other desktop application.
Note: If the application does not compile, fix any syntax or spelling errors that you inadvertently entered into the code. Errors and warnings are displayed in the Problems view in Flash Builder.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application

Package, sign, and run your AIR application

You are now ready to package the "Hello World" application into an AIR file for distribution. An AIR file is an archive file that contains the application files, which are all of the files contained in the project’s bin folder. In this simple example, those files are the SWF and application XML files. You distribute the AIR package to users who then use it to install the application. A required step in this process is to digitally sign it.
1 Ensure that the application has no compilation errors and runs as expected.
2 Select Project > Export Release Build.
3 Check that the AIRHelloWorld project and AIRHelloWorld.mxml application are listed for project and
application.
4 Select Export as signed AIR package option. Then click Next.
5 If you have an existing digital certificate, click Browse to locate and select it.
6 If you must create a new self-signed digital certificate, select Create.
7 Enter the required information and click OK.
8 Click Finish to generate the AIR package, which is named AIRHelloWorld.air.
You can now install and run the application from the Project Navigator in Flash Builder or from the file system by double-clicking the AIR file.
22

Creating your first desktop AIR application using Flash Professional

For a quick, hands-on demonstration of how Adobe® AIR® works, follow the instructions in this topic to create and package a simple “Hello World” AIR application using Adobe® Flash® Professional.
If you haven’t already done so, download and install Adobe AIR, which is located here: www.adobe.com/go/air.

Create the Hello World application in Flash

Creating an Adobe AIR application in Flash is much like creating any other FLA file. The following procedure guides you through the process of creating a simple Hello World application using Flash Professional.
To create the Hello World application
1 Start Flash.
2 In the Welcome Screen, click AIR to create an empty FLA file with Adobe AIR publish settings.
3 Select the Text tool in the Tools panel and create a static text field (the default) in the center of the Stage. Make it
wide enough to contain 15 -20 characters.
4 Enter the text “Hello World” in the text field.
5 Save the file, giving it a name (for example, HelloAIR).

Test the application

1 Press Ctrl + Enter or select Control ->Test Movie->Test to test the application in Adobe AIR.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application
2 To use the Debug Movie feature, first add ActionScript code to the application. You can try it quickly by adding a
trace statement like the following:
trace("Running AIR application using Debug Movie");
3 Press Ctrl + Shift + Enter, or select Debug->Debug Movie->Debug to run the application with Debug Movie.
The Hello World application looks like this illustration:
23

Package the application

1 Select File > Publish.
2 Sign the Adobe AIR package with an existing digital certificate or create a self-signed certificate using the following
steps:
a Click the New button next to the Certificate field.
b Complete the entries for Publisher name, Organizational unit, Organizational name, E-mail, Country,
Password, and Confirm Password.
c Specify the type of certificate. The certificate Type option refers to the level of security: 1024-RSA uses a 1024-
bit key (less secure), and 2048-RSA uses a 2048-bit key (more secure).
d Save the information in a certificate file by completing the Save as entry or clicking the Browse... button to
browse to a folder location. (For example, C:/Temp/mycert.pfx). When you’re finished click OK.
e Flash returns you to the Digital Signature Dialog. The path and filename of the self-signed certificate that you
created appears in the Certificate text box. If not, enter the path and filename or click the Browse button to locate and select it.
f Enter the same password in the Password text field of the Digital Signature dialog box as the password that you
assigned in step b. For more information about signing your Adobe AIR applications, see
AIR file” on page 181.
3 To create the application and installer file, click the Publish button. (In Flash CS4 and CS5, click the OK button.)
You must execute Test Movie or Debug Movie to create the SWF file and application.xml files before creating the AIR file.
Digitally signing an
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application
4 To install the application, double click the AIR file (application.air) in the same folder where you saved your
application.
5 Click the Install button in the Application Install dialog.
6 Review the Installation Preferences and Location settings and make sure that the ‘Start application after installation’
checkbox is checked. Then click Continue.
7 Click Finish when the Installation Completed message appears.

Create your first AIR application for Android in Flash Professional

To develop AIR applications for Android, you must download the Flash Professional CS5 extension for Android from
Adobe Labs.
You must also download and install the Android SDK from the Android web site, as described in: Android Developers:
Installing the SDK.
Create a project
1 Open Flash Professional CS5
2 Create a new AIR for Android project.
The Flash Professional home screen includes a link to create an AIR for Android application. You can also select File > New, and then select the AIR for Android template.
24
3 Save the document as HelloWorld.fla
Write the code
Since this tutorial isn't really about writing code, just use the Text tool to write, "Hello, World!" on the stage.
Set the application properties
1 Select File > AIR Android Settings.
2 In the General tab, make the following settings:
Output File: HelloWorld.apk
App name: HelloWorld
App ID: HelloWorld
Version number: 0.0.1
Aspect ratio: Portrait
3 On the Deployment tab, make the following settings:
Certificate: Point to a valid AIR code-signing certificate. You can click the Create button to create a new
certificate. (Android apps deployed via the Android Marketplace must have certificates that are valid until at least 2033.) Enter the certificate password in the Password field.
Android deployment type: Debug
After Publish: Select both options
Enter the path to the ADB tool in the tools subdirectory of the Android SDK.
Last updated 12/7/2015
BUILDING ADOBE AIR APPLICATIONS
Creating your first AIR application
4 Close the Android settings dialog by clicking OK.
The app does not need icons or permissions at this stage in its development. Most AIR apps for Android do require some permissions in order to access protected features. You should only set those permissions your app truly requires since users may reject your app if it asks for too many permissions.
5 Save the file.
Package and Install the application on the Android device
1 Make sure that USB debugging is enabled on your device. You can turn USB debugging on in the Settings app under
Applications > Development.
2 Connect your device to your computer with a USB cable.
3 Install the AIR runtime, if you have not already done so, by going to the Android Market and downloading Adobe
AIR. (You can also install AIR locally using the for use on Android devices and emulators are included in the AIR SDK.)
4 Select File > Publish.
Flash Professional creates the APK file, installs the app on the connected Android device, and launches it.
ADT installRuntime command” on page 169. Android packages
25

Creating your first AIR application for iOS

AIR 2.6 or later, iOS 4.2 or later
You can code, build, and test the basic features of an iOS application using only Adobe tools. However, to install an iOS application on a device and to distribute that application, you must join the Apple iOS Developer program (which is a fee-based service). Once you join the iOS Developer program you can access the iOS Provisioning Portal where you can obtain the following items and files from Apple that are required to install an application on a device for testing and for subsequent distribution. These items and files include:
Development and distribution certificates
Application IDs
Development and distribution provisioning files

Create the application content

Create a SWF file that displays the text, “Hello world!” You can perform this task using Flash Professional, Flash Builder, or another IDE. This example simply uses a text editor and the command line SWF compiler included in the Flex SDK.
1 Create a directory in a convenient location to store your application files. Create a file named, HelloWorld.as and
edit the file in your favorite code editor.
2 Add the following code:
Last updated 12/7/2015
Loading...
+ 269 hidden pages