I am very new to AIR development and have just started seriously creating my first simple application. I would like to open a new window to ask the user for the necessary settings at the first start. When testing a new window and detecting its closed state, I performed the following (some jQuery codes are included):
The following code is used to open a new window when the main application starts (as it appears when it opens).
$(document).ready(function(){
var options = new air.NativeWindowInitOptions();
options.type = air.NativeWindowType.UTILITY;
var windowBounds = new air.Rectangle(200,250,300,400);
newHTMLLoader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);
newHTMLLoader.load(new air.URLRequest("setup.html"));
newHTMLLoader.window.opener = window;
newHTMLLoader.window.nativeWindow.addEventListener(air.Event.CLOSE, handleNewSettings);
}
, jQuery document.ready. - . - , , - , , , ( ).
function handleNewSettings(event){
newHTMLLoader.removeEventListener(Event.CLOSE, arguments.callee);
alert('yay');
window.close();
}
AIR :
ActionScript: "TypeError: # 2007: . flash.events::EventDispatcher/removeEventListener()"
, , JS. removeEventListener, , , ; , . , .