views:

778

answers:

3

NativeApplication.nativeApplication.exit(); - this method is used for exit the application of flex/air . application.close(); - this method also used for exit the application of flex/air - So what is different?

A: 

I am not sure I am understanding your question entirely because I am not finding an application.close() method.

Here is the documentation on NativeApplication, an AIR only class: http://livedocs.adobe.com/flex/3/langref/flash/desktop/NativeApplication.html#exit()

It defines the exit method like this:

Terminates this application.

The call to the exit() method will return; the shutdown sequence does not begin until the currently executing code (such as a current event handler) has completed. Pending asynchronous operations are canceled and may or may not complete.

Note that an exiting event is not dispatched. If an exiting event is required by application logic, call NativeApplication.nativeApplication.dispatchEvent(), passing in an Event object of type exiting. Likewise, closing and close events are not dispatched before application windows are closed. If windows should be notified before your application exits, you can dispatch closing events for each open window. If a window close event is required, call the window's close() method before exiting.

Here is the documetation on Application, a Flex class: http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#methodSummary

It does not seem to have a close() method associated with it. Are you possibly confusing the application class with a window class that you need to close before calling the NativeApplication.nativeApplication.exit() ?

I would be happy to help you research this further if you can clarify the question.

Ryan Guill
thank you so much Ryan Guill
+1  A: 

He is referring to NativeApplication.exit() vs WindowedApplication.close().

WindowedApplication.close()
Closes the application's NativeWindow (the initial native window opened by the application). This action is cancelable.

Calling close() on the application window will effectively shut down the application, but using the exit() method on NativeApplication is the proper way to terminate it. See the following link for more info:

http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html

Stiggler
A: 

One completely exits the application, the other only closes the main window. It's important to understand the difference. On a Mac, for instance, closing all of an application's windows often leaves that application running in the dock. This is rarely the case on Windows, but if you have a dock icon, you should get similar behavior, I think.

joshtynjala
joshtynjala thanks fro response me