Invisible AIR applications…another implementation method.
So I had it on my TODO list to blog about invisible AIR applications, and then MXNA introduced this recent blog post of Shigeru Nakagaki:
I guess it’s time for me to stop procrastinating…
The good news for me is that Shigeru came up with a completely different way of tackling the issue than I had used. First, I’d like to thank a couple blog posts that helped me during my task:
- Jeffry Houser and Saskovic Radovanovic:
So here is what I came up with. Basically the window launches then on applicationComplete it closes. The other things to take into account is preventing default actions on the event and then to make sure the AIR app doesn’t autoExit.
[EDITED: The initial code highlighting wordpress plugin I installed jacked up the code. I changed the pluging and re-added the code. START]
Here’s the code.
- applicationComplete="_onApplicationComplete( event )">
- private function _onApplicationComplete( p_evt:Event ):void
- // let's catch close
- addEventListener( Event.CLOSING, _onClosing );
- // close the application window
- private function _onClosing( p_evt:Event ):void
- // prevent the default action
- // make sure the application process keeps running after the window is closed
- NativeApplication.nativeApplication.autoExit = false;
- // close the window
- trace("I am invisible!");
[EDITED: The initial code highlighting wordpress plugin I installed jacked up the code. I changed the pluging and re-added the code. END]
Here’s a link to the app.
Btw, since the app runs invisibly, the only way you’ll have to close it once it’s running is to use an operating system tool such as Task Manager on Windows or kill in the Mac terminal to stop the “InvisibleApp.exe” process on your system…can you say evil? Gwa-ha-ha…