I found out an another way to trigger this bug that does not terminate program correctly. Here a way to reproduce the bug:
Start an AIR application, let it load.
Go to your taskbar on the bottom of the screen and find you AIR application there.
Right click on that AIR application
Click Close
Open up your task manager and go to Processes
After you closed it as mentioned above, your AIR program is actually still running in the process list even tho it got closed. It should have been terminated but it never did due this bug.
I tested this bug on Window XP service pack 2 and Window Vista Service Pack 1. Both are affected. I have not be able to test this on Mac OS X.
If you trigger this bug, your program wont be able to rerun again unless you reboot your computer or log off/log back in.
I have not report this bug yet.
No solution yet
except tell the user not to right click -> close as mentioned above...
Use the following code to close the application properly.
public function applicationExit():void
{
var exitingEvent:Event = new Event(Event.EXITING, false, true);
NativeApplication.nativeApplication.dispatchEvent(exitingEvent);
if (!exitingEvent.isDefaultPrevented()) {
NativeApplication.nativeApplication.exit();
}
}
call this funciton by using the close event in <mx:WindowedApplication close="applicationExit()">
More details about this can be found here: http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63 e3d118676a5d46-8000.html
Hi there, i had such problem too and the code given by coolkams didnt work for me.
Here is what i did :
First thing i want to know the the main app is activated:
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onAppactivation);
Then the callback function add a CLOSE event listener to the current active window wich is the main application window:
private function onAppactivation(e:Event):void
{
NativeApplication.nativeApplication.removeEventListener(Event.ACTIVAT E, onAppactivation);
NativeApplication.nativeApplication.activeWindow.addEventListener(Eve nt.CLOSE, applicationExit);
}
Finnaly in the CLOSE event callback function :
private function applicationExit(e:Event):void
{
e.currentTarget.removeEventListener(Event.CLOSE, applicationExit);
NativeApplication.nativeApplication.exit();
}
That did the trick for me, hope it will help other people too...
North America
Europe, Middle East and Africa
Asia Pacific