apache-flex - 处理 AIR 应用程序中的应用程序退出事件

标签 apache-flex air

我有一个 AIR 应用程序,其中定义了以下 EXIT 处理程序:

  NativeApplication.nativeApplication.addEventListener(Event.EXITING, applicationExitHandler); 

applicationExitHandler 通过 HttpService 发出异步注销请求。由于这是异步的,因此看起来应用程序的 exit() 方法在实际发出注销请求之前返回。

如何确保请求在 exit() 返回之前完成?

最佳答案

覆盖默认行为。取消这个事件。然后调用服务。向您的服务添加请求处理程序/故障处理程序。完成时调用结果或故障处理程序。这是您可以安全退出应用程序的时间(当然,如果注销失败,您可能需要额外处理)。来自docs :

exiting Dispatched when the application exit sequence is started.

The exiting event is dispatched when application exit is initiated by the operating system; for example, when a user issues the Cmd-Q key sequence on Mac OS X, or when the autoExit property of the NativeApplication object is true and the last application window is closed. Canceling this event prevents the application from exiting.

Note: Calling the NativeApplication exit() method does not cause an exiting event to be dispatched. To warn components of an impending exit, dispatch the exiting event before calling exit() The Event.EXITING constant defines the value of the type property of an exiting event object.

关于apache-flex - 处理 AIR 应用程序中的应用程序退出事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/589304/

相关文章:

javascript - 在 Adob​​e AIR HTML 应用程序中强制全屏显示

ios - 空气原生扩展 FDT

javascript - 如何在 Adob​​e Air Extension for Dreamweaver 3.3 下的 Javascript 中获取鼠标坐标?

linux - 为什么在 Linux 上打包的 AIR 应用程序在 Mac 上使用时会损坏?

apache-flex - 从 Flex 访问浏览器 cookie

java - Tomcat 启动(web.xml)问题

javascript - Flash Player 通知浏览器正在关闭++

apache-flex - 新手无法让 Tomcat 重新加载 Flex/BlazeDS 应用程序

apache-flex - 如何在运行时更改 Flex 3.5 应用程序的应用程序背景颜色?

ios - AS3 中的配置文件?