Chapter 14. File Types

When a file type is associated with your AIR application, then every associated file of that type will open itself in your AIR application. This gives you great opportunities to work with external files in your AIR application. Registering Custom File Types discusses how to register a file type with your AIR application.

Before you begin, you should note that you make associations for an AIR application when installing the application, not at compile or debug time. This means you can’t test file associations until you package and install your application. When your application is packaged, the application descriptor XML file is read, and the file associations are set. This is not automatically done if another application on the system is already the default application; in other words, the AIR application install process does not override an existing file type association. If you want to take over the association from another application, take a look at Setting and Removing an Application as the Default Application for a File Type.

Registering Custom File Types

Problem

You want to register a custom file type so that the operating system will associate it with your AIR application.

Solution

Use the fileTypes element in the application descriptor file to declare the file types associated with your AIR application.

Discussion

Associations between your application and a file type must be declared in the application descriptor file. Depending on your environment and compiler ...

Get Adobe AIR 1.5 Cookbook 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.