Can One AIR Application Launch Another?

Commenter madhu asked whether one AIR application can launch another. The answer is yes, albeit indirectly.

There is no API (at least, not yet) that allows AIR applications to directly launch other applications. However, AIR applications can be launched from a web page via the AIR Browser API. (Note that applications have to opt-in to be launched in this way.) And since you can host a web page in side an AIR application, it’s possible to make this work with a couple of levels of indirection—and one click from your user.

Here’s the basic recipe:

  1. In the application-to-be-launched, make sure <allowBrowserInvocation> is set in its descriptor.
  2. In the launching application, create an instance of HTMLLoader.
  3. Write a SWF that will, on a user click, call the Browser API launchApplication() method. (You can use the sample badge SWF in the SDK for this.)
  4. Load this SWF into your HTMLLoader instance.

The click from the user is required for reasons previously discussed.

Final note: This method can also be used to enable the installation of one AIR application from another.