Air sub applications

2019-07-10 07:39发布

问题:

Hi Is it possible for an Adobe Air application to install, upgrade and execute other Adobe-Air files.

The basic use case is for a launcher application. It launches and manages other applications at user request, however doesn't need to install the runtimes until such a point as the user intends to execute it.

EDIT: A good starting point may be in this question AIR App that Loads and Runs Existing AIR swf

EDIT I'm going to cross post this to flexcoders though I'm not really happy with doing it.

回答1:

AIR 2.0, when installed with the extended desktop profile (native installers) can use the NativeProcess class to control any application on the system, monitor its commandline feedback, and terminate as needed. Extremely basic example below:

import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;

if (NativeProcess.isSupported) {
    var npsi:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    var processpath:File = File.applicationDirectory.resolvePath("MyApplication.whatever");
    var process:NativeProcess = new NativeProcess();

    npsi.executable = processpath;
    process.start(npsi);
}

You should additionally be monitoring specific IO events, error events, the exit event, and you can also provide command line arguments in the NativeProcessStartupInfo object. As for installing, that might be tricker, because AIR has a graphical installation process and I haven't experimented with it that much, but it should be able to run an installer.

AIR applications can also provide a custom upgrade interface; however, I don't think another AIR application can manage that task. Given that AIR apps upgrade themselves fairly seamlessly, that could be left as is.



回答2:

Have you tried File.openWithDefaultApplication()?



标签: installer air