Open local file with AIR / Flex

19,548

Solution 1

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

Solution 2

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

Solution 3

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/

Share:
19,548
Shawn
Author by

Shawn

a long time ago i found an xss vuln here and took down the entire site userid 26, respect

Updated on June 04, 2022

Comments

  • Shawn
    Shawn about 2 years

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