I am trying the following but every once in awhile the nativeApp is not defined.
var nativeApp:Object = getDefinitionByName("flash.desktop.NativeApplication");
nativeApp.nativeApplication.exit();
I am confused why sometimes getDefinitionByName("flash.desktop.NativeApplication") resolves and other times it does not.
I am trying to resolve this problem to address the following issue in flexcover - code.google.com/p/flexcover/issues/detail?id=33
Update - here is the class I am attempting to fix: http://code.google.com/p/flexcover/source/browse/trunk/CoverageAgent/src/com/allurent/coverage/runtime/AbstractCoverageAgent.as CoverageAgent.swc is an actionscript library called by the unit tests to exit the flexcover air application used to determine the code coverage of the unit tests. The flexcover air application only exits about the half the time and it is causing problems for our maven builds to execute successfully.