Working with AIR Features

As mentioned previously, AIR allows additional features beyond those of a Flex web application. In the following sections, you’ll learn about working with these features.

Accessing the Local Filesystem

Arguably, one of the most significant features of AIR applications is that they can access the local filesystem. That means that with Flex AIR applications, you can read, write, create, move, and delete files and directories.

Referencing files and directories

As far as AIR is concerned, all files and directories are similar enough that AIR defines just one type of object for both: the flash.filesystem.File class. Instances of the File class reference files or directories. When you want to get a reference to an existing file or directory, the ideal way to do so is to use a relative reference. Using relative references helps to avoid absolute references that might be platform- or system-specific, thereby allowing applications to run across many computers and many operating systems. To facilitate retrieving relative references, AIR defines a handful of built-in references to common directories. These include the following:


The directory in which the AIR application is installed.


The directory in which the AIR application can store files. This directory is unique to the AIR application, but it is also a different directory than the directory in which the application is installed.


The desktop ...

Get Programming Flex 3 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.