Paste this code into any action in any empty frame.
var exitingEvent:Event = new Event(Event.EXITING, false, true);
NativeApplication.nativeApplication.dispatchEvent(exitingEvent);
if (!exitingEvent.isDefaultPrevented()) {
NativeApplication.nativeApplication.exit();
}
create button and direct action to the empty frame that included with the code.
Automatically apps will exit.