Répondre à ma propre question ici. « A tout détraqué de JavaScript » peut se résumer en une ligne ridicule:
var myWindow = air.NativeApplication.nativeApplication.openedWindows[intWindowCount].stage.getChildAt(0).window
myWindow.document.getElementById('status').innerHTML = "success";
Cela suppose que vous utilisez NativeWindow et le chargement HTML en utilisant HTMLLoader et vous êtes seulement charger un enfant. intWindowCount
représente le nombre de fenêtres ouvertes (y compris l'introspecteur). 0
représente le nombre d'enfants que vous avez créé à l'aide de la méthode stage.addChild()
. Le code que j'utilise est ci-dessous dans son intégralité. Il y a probablement un certain ménage à faire, mais il devrait être un bon point de départ pour toute personne qui a besoin de faire la même chose:
var htmlView = new air.HTMLLoader();
htmlView.width = 300;
htmlView.height = 500;
var objWindowOptions = new air.NativeWindowInitOptions();
objWindowOptions.transparent = false;
objWindowOptions.systemChrome = air.NativeWindowSystemChrome.STANDARD;
objWindowOptions.type= air.NativeWindowType.NORMAL;
var wWindow = new air.NativeWindow(objWindowOptions);
wWindow.x = objScreen.x;
wWindow.y = objScreen.y;
wWindow.width = objScreen.width;
wWindow.height = objScreen.height;
wWindow.activate();
wWindow.stage.align = "TL";
wWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE;
wWindow.stage.scaleMode = "noScale";
wWindow.stage.addChild(htmlView);
htmlView.load(new air.URLRequest("pageTwo.html"));
setTimeout(function(){
objScreen.setWindowReference(air.NativeApplication.nativeApplication.openedWindows[intWindowCount].stage.getChildAt(0).window);
objScreen.setClock(cClock);
cClock.screen = objScreen;
},500);
Le délai d'attente à la fin est un hack horrible, embarrassant. Je ne l'utilise que parce que je n'ai pas encore trouvé le bon événement à utiliser avec addEventListener()
.