i'm trying make popup window class content disaplyobject, , popup , display in itself, i'm cracking head matching size of content window or vise versa... think maybe window not display of stage or ?!
the content way big..and goes out of bounds.
here code :
public class subwindow extends nativewindow{ public function subwindow() { var windowoptions:nativewindowinitoptions = new nativewindowinitoptions(); windowoptions.systemchrome = nativewindowsystemchrome.standard; windowoptions.type = nativewindowtype.utility; windowoptions.resizable = false; super(windowoptions); this.stage.align = stagealign.top_left; width = 400; height = 400; title = "are sure?"; alwaysinfront = true; activate(); visible = false; addeventlistener(event.closing, closewindow, false, 0, true); } public function closewindow(e:event) { e.stopimmediatepropagation(); e.stoppropagation(); e.preventdefault(); visible = false; } public function setcontent(cont:displayobject) { visible = true; //this.width = stage.stagewidth; //this.height = stage.stageheight; trace(cont.getbounds(stage), width, height, stage.stagewidth,stage.stageheight); cont.height = stage.stageheight; cont.width = stage.stagewidth; cont.x = cont.y = 0; this.stage.addchild(cont); trace(cont.width, width, height, stage.stagewidth,stage.stageheight); } }
thanks, mik
now i've solved think!
first create content:
var mycontent:mycustomcontentclass = new mycustomcontentclass();
then create window , set size , position
var mywindow:nativewindow = new nativewindow(); mywindow.stage.align = stagealign.top_left; mywindow.width = mycontent.width; mywindow.height = mycontent.height
and set scale mode no scale:
mywindow.stage.scalemode = stagescalemode.no_scale;
and add content
mywindow.stage.addchild(mycontent); mywindow.activate();
i still have minor ssues when running on osx, think has size of system chrome.
Comments
Post a Comment