1

我正在尝试控制 Air 应用程序的退出,但无法让应用程序实际退出。我正在使用具有扩展桌面配置文件的本机进程,并在退出时尝试运行脚本。现在它似乎退出了,但该过程仍在运行。我必须通过任务管理器结束该过程。下面的代码:

这是退出事件的事件处理程序。

函数退出(){

//remove the exit event handler
air.NativeApplication.nativeApplication.removeEventHandler(air.Event.EXITING,exit); 
//close the window
var winClosingEvent; 
var win = air.NativeApplication.nativeApplication.openedWindows[0]; 
closingEvent = new air.Event(air.Event.CLOSING,false,true); 
win.dispatchEvent(closingEvent); 
win.close();

//dispatch an exit event and force exit

var exitingEvent = new air.Event(air.Event.EXITING, false, false);
air.NativeApplication.nativeApplication.dispatchEvent(exitingEvent);    
air.NativeApplication.nativeApplication.exit();

}

4

0 回答 0