Open local file with AIR / Flex

actionscript-3airapache-flex

I have written an AIR Application that downloads videos and documents from a server. The videos play inside of the application, but I would like the user to be able to open the documents in their native applications.

I am looking for a way to prompt the user to Open / Save As on a local file stored in the Application Storage Directory. I have tried using the FileReference + URLRequest classes but this throws an exception that it needs a remote url.

My last resort is just copying the file to their desktop : \

Best Answer

You can use the new openWithDefaultApplication(); function that's available on the File class (I believe it's only available in AIR 2)

eg:

var file:File = File.desktopDirectory.resolvePath(fileLocation);
file.openWithDefaultApplication();
Related Topic