This post, the 2nd of many, is about how to run more than one instance of an AIR app at the same time. Here is the only relevant adobe bug I could find on the matter, and it’s been closed saying the request has been forwarded to the AIR team. That was over a year and a half ago. When the user tries opening an AIR app that is already open, it sends an invoke event to the one already running and blocks additional ones from opening. Because of how this appears to work, it stands to reason that Adobe intends this behavior. Luckily, you can still run multiple instances with a bit of effort… sort of. I say sort of, because you actually have to make a small change to any additional instance to run it… so, technically, you might say it’s not really another instance.
In the installation directory of the AIR app is a file called “application.xml”. Yep, it’s essentially a copy of the file automatically created when starting a new AIR app. On windows, it’s at:
“…yourInstallDirectory/META-INF/AIR/application.xml”
On Mac, you can open the .app package and find it at:
“…yourInstallDirectory/Contents/Resources/META-INF/AIR/application.xml”
One of the nodes in this file is the id node. This appears to be how AIR recognizes if an AIR app is unique or if the same one is already running. Change the id then save the file, and you can launch another one. For my purposes, the user exports a new app which runs a presentation they’ve built. In reality, the player app they export is the same app they used to build the presentation but in a different state. To export, I am copying the air app, it’s dependent files, and some additional resources to where ever the user wishes to export. Once copied, I modify application.xml as described above, so as to allow the user to launch the export without first closing the builder application (which, again, are the same app).
I hope, as with all these workarounds, that you 1st go through why Adobe decided to lock this down in the first place and determine if you really should be working around it. The last thing I want is for these techniques to be abused, both tainting AIR and forcing Adobe to implement more restrictions. I consider my need to have been a corner case, but don’t intend to use this workaround very often, if at all, in future projects.
Disclaimer over. I hope this both made sense and helps someone out there. Feel free to drop a comment if something is unclear, wrong, or if you feel code samples or anything are needed in addition.