Flex – Adobe Air – Opens the file with air

So I created an Air application that can be saved as a custom file type. I set the file association when I published the application, and when you double-click the file, it will open the air Application. Is there any hook to detect that the application is opened through a file? Obviously, I need to detect this, and then let the application open the file itself.
listen to InvokeEvent, it will save all The arguments attribute of the requested file name:

Quick mxml example:


< mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:s="spark.components.*"
invoke="onAppInvoke( event);">
import mx.controls.Alert;

private function onAppInvoke(event:InvokeEvent):void {< br /> if (event.arguments.length>0) {
// ok app call with an arguments
var fileName:String=event.arguments[0];
Alert.show( "app open with: "+fileName);
} else {
// app open normally
Alert.show("normal launch");
}
}
]]>

So I created an Air application that can be saved as Custom file type. I set the file association when publishing the application. When you double-click the file, it will open the air application. Is there any hook to detect that the application is opened through the file? Obviously, I need to detect this and then let the application open the file itself.

Listen to InvokeEvent, it will save the arguments property of the requested file name:

Quick mxml example:


xmlns:mx=" http://www.adobe.com/2006/mxml"
xmlns:s="spark.components.*"
invoke="onAppInvoke(event);">
import mx.controls.Alert;

private function onAppInvoke(event:InvokeEvent):void {
if (event.arguments.length>0 ) {
// ok app call with an arguments
var fileName:String=event.arguments[0];
Alert.show("app open with: "+fileName);
} else {
// app open normally
Alert.show("normal launch");
}
}
]]>

Leave a Comment

Your email address will not be published.