Air 控制spark.components.Window的X和Y

Air 控制spark.components.Window的X和Y,air,flex4,nativewindow,Air,Flex4,Nativewindow,我正在Flex4中构建一个air应用程序。我正在创建一个无铬应用程序中需要的窗口 以下是我在我的主应用程序创建完成 protected function creationCompleteHandler(event:FlexEvent):void { facade.sendNotification(AppFacade.APP_INIT, this); var buttons:NavigatorWindow =

我正在Flex4中构建一个air应用程序。我正在创建一个无铬应用程序中需要的窗口

以下是我在我的主应用程序创建完成

protected function creationCompleteHandler(event:FlexEvent):void
            {

                facade.sendNotification(AppFacade.APP_INIT, this);
                var buttons:NavigatorWindow = new NavigatorWindow();
                var workingSets:WorkingSets = new WorkingSets();
                buttons.addElement( workingSets );
                buttons.width = 115;
                buttons.height =200;
                buttons.maximizable = false;
                buttons.resizable = false;

                buttons.addEventListener(AIREvent.WINDOW_COMPLETE, onWindowComplete);
                buttons.open();


            }

            private function onWindowComplete(event:AIREvent):void
            {
                event.currentTarget.x = 100;
                event.currentTarget.y = 100;
            }

由于某些原因,应用程序将窗口添加到屏幕中间,如果设置窗口的x和y,它就不会把它放在我期望屏幕左上方的地方。当车窗打开时,如何将其定位在所需的位置


谢谢,

spark.components.Window存在于NativeWindow中。如果您想在屏幕上移动NativeWindow,则需要将其定位。这有点混乱,因为您也可以将窗口定位在本机窗口内。您必须在创建完成后进行定位,否则将出现空引用错误

如果基于spark.components.window创建了组件,则可以这样调用窗口:

var win:MyWindow = new MyWindow();  //MXML component
win.height = 150;
win.width = 300;
win.systemChrome = NativeWindowSystemChrome.NONE;
win.type = NativeWindowType.LIGHTWEIGHT;
win.showStatusBar = false;
win.transparent = true;
win.alwaysInFront = true;
win.open(true);
然后在该mxml组件中,设置creationComplete事件处理程序来执行以下操作:

var padding:int = 25;
this.nativeWindow.x = Screen.mainScreen.visibleBounds.right - this.width - padding;
this.nativeWindow.y = Screen.mainScreen.visibleBounds.top + padding;

这将使新窗口位于右上角,右上角有25像素的填充。

事实上,我发现您必须在窗口上调用move()。