views:

5404

answers:

4

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 : \

+1  A: 

Only way I could figure out how to do it without just moving the file and telling the user was to pass it off to the browser.

navigateToURL(new URLRequest(File.applicationStorageDirectory.nativePath + "/courses/" + fileName));
Shawn Simon
A: 

Currently adobe is not supporting opening files in there default applications. Passing it off to the browser seems to be the only way to make it work.

You could however use a FileStream and write a small html file with some javascript that sets the location of an iframe to the file, then after 100ms or so calls window.close(). Then open that file in the browser.

maclema
+1  A: 

This is the first release of the FluorineFx Aperture framework.

The framework provides native OS integration (Windows only) support for AIR desktop applications.

The framework extends Adobe AIR applications in a non-intrusive way: simply redistribute the provided libraries with your AIR application, at runtime the framework will automatically hook into your application.

Features

  • Launch native applications and documents with the provided apsystem library
  • Take screenshots of the whole screen with the provided apimaging library
  • Access Outlook contacts from an Air application with the provided apoutlook library

http://aperture.fluorinefx.com/

+1  A: 

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();
Chris