Hi,
I've been trying to find some answers on how to add children to a new window with no luck. If I create a new native window . . .
var newWindow:NativeWindow = new NativeWindow( initOptions );
how do I add children to it.
I'd appreciate you input.
Best regards,
C.S.
In case anyone reads this. Further experimenting isolated the problem as being relative to adding loaded content. If I add a textfield for example using the addChild method it appears no problem. Also if I add loader content to the main nativeWindow it appears no problem. But when adding loaded content to the new window, it does not appear.
Hi,
I stumbled onto the answer.
It has to do with the scaleMode. In the following code example if, noScale is commented out the jpg doesn't appear to be added. When I altered the test to add a SWF, I saw the oversized SWF which led me to test the scaleMode.
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Sprite;
var screenBounds:Rectangle = Screen.mainScreen.bounds;
var screenWidth:Number = screenBounds.width
var screenHeight:Number = screenBounds.height
stage.nativeWindow.x = Math.floor((screenBounds.width - stage.nativeWindow.width)/2);
stage.nativeWindow.y = Math.floor((screenBounds.height - stage.nativeWindow.height)/2);
var AppLoader:Loader = new Loader();
AppLoader.load(new URLRequest("test.jpg"));
AppLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, reportComplete);
var holderMC:MovieClip;
function reportComplete(event:Event) {
trace("COMPLETE")
holderMC = new MovieClip;
//holderMC.addChild(AppLoader.content)
//addChild(holderMC) // works as does addChild(AppLoader) or addChild(AppLoader.content)
openWindow()
}
function openWindow():void {
var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
initOptions.systemChrome = NativeWindowSystemChrome.NONE;
var newWindow:NativeWindow = new NativeWindow( initOptions );
newWindow.width = screenWidth-100;
newWindow.height = screenHeight-100;
newWindow.x = 50
newWindow.y = 50
newWindow.stage.align = "TL";newWindow.stage.scaleMode = "noScale"; //If commented out the jpg disappears
newWindow.stage.addChild(AppLoader.content);
newWindow.activate();
}
North America
Europe, Middle East and Africa
Asia Pacific