I did something similar but with another approach:
- I didn't opened a second window for a splash screen but rather put the content of the splash screen in a div inside the index.html and put it before the actual content.
- I set the initial width and height to splash screen measures.
- After the application has completely loaded I removed the splash screen div from the DOM and set width and height to application measures.
UPDATE:
How do I provide the content for the splash screen (I've added some code to create a window and load in a splash.html page, but it currently breaks as I believe the code is ActionScript rather than JavaScript)?
First: There is no ActionScript. It's JavaScript but you have to use it in the right way. You missed air. which represents the library object for Air.
// Create a new window that will become the splash screen
var options = new air.NativeWindowInitOptions();
options.systemChrome = air.NativeWindowSystemChrome.STANDARD;
options.transparent = false;
// Add content to new window
var htmlLoader = air.HTMLLoader.createRootWindow(false, options, false);
htmlLoader.window.nativeWindow.width = 300;
htmlLoader.window.nativeWindow.height = 500;
htmlLoader.window.nativeWindow.visible = true;
htmlLoader.load(new air.URLRequest('splash.html'));
Close the new splash screen (how do I choose which window to close)?
// That is your splash screen
htmlLoader.window.nativeWindow.close();
Show the correct initial screen on load (how do I choose the correct window)?
// This is your main window
window.nativeWindow.visible = true;