With the last release of AIR beta 2 comes more detailed file type asociation.
This is the fileTypes tag in the AIR configuration XML:
<fileType>
<name>com.example</name>
<extension>xmpl</extension>
<description>Example file</description>
<contentType>example/x-data-type</contentType>
<icon>
<image16x16>icons/AIRApp_16.png</image16x16>
<image32x32>icons/AIRApp_32.png</image32x32>
<image48x48>icons/AIRApp_48.png</image48x48>
<image128x128>icons/AIRApp_128.png</image128x128>
</icon>
</fileType>
</fileTypes>
There's a description of some of these paremeters at the Adobe Live Docs site.
The code above, registers the types with your application, so the AIR app is open upon clicking any file with the right extension. In order to perform an action (eg. open), we need to retrieve the value of such file.
To do so we need to add the following code to the "invoke" event in the WindowedApplicaton ( invoke="onInvoke(event) ):
{
//trace("Invoke event received.");
if(invokeEvent.arguments.length> 0){
trace("Application opened with: "+event.arguments[0]); // file path
// ...
// custom code
// ...
} else {
trace("--no arguments--");
}
}
Again, at Adobe you can find more details.
Finally, if you want a full detailed tutorial go over to Setting Up an AIR Application with File Associations where you'll find an excellent step-by-step guide by senocular.



