【问题标题】:Set Popup Window Specific Position?设置弹出窗口特定位置?
【发布时间】:2013-02-06 08:40:13
【问题描述】:

其实在我的应用登录页面是Popup..

private var login:Login;

        protected function loginPopUpHandler(event:MouseEvent):void
        {
            login = new Login();
            PopUpManager.addPopUp(login,this,true);
            PopUpManager.centerPopUp(login);
        }

听到 Popup 即将来到 Center .... 但我想要按钮下方的弹出窗口..

即...当我们点击登录按钮弹出将在按钮下方打开..

【问题讨论】:

  • 你能把弹出窗口中的 x 和 y 值放在按钮下方吗?
  • 设置按钮深度和弹出深度..
  • 举个小例子让我更了解..

标签: actionscript-3 apache-flex flex4 flex3


【解决方案1】:

试试:

var sym:Login = PopUpManager.createPopUp( this, Login) as Login;
    sym.x     = button.x; 
    sym.y     = button.y+button.height;

【讨论】:

    【解决方案2】:

    首先取决于this 是什么。例如,如果this 是您的登录按钮,您可以轻松地这样做:

    protected function loginPopUpHandler(event:MouseEvent):void
                {
                    login = new Login();
                    PopUpManager.addPopUp(login,this,true);
                    PopUpManager.centerPopUp(login);
                    login.x += loginButton.width / 2; // or any other number
                    login.y += 123; //whatever number. try tweaking it
                }
    

    如果您想将显示对象用作FlexGlobals.topLevelApplication as DisplayObject,那么您可能希望从event.target 获取登录按钮并使用其坐标进行操作。只是尝试进行实验。
    此外,您在使用坐标时可能必须使用localToGlobal 属性。

    【讨论】:

      【解决方案3】:

      为我工作:

      protected function loginPopUpHandler(event:MouseEvent):void
                  {
                      login = new Login();
                      login.x = 10; // x value relative to "this"
                      login.y = 123; // y value relative to "this"
                      PopUpManager.addPopUp(login,this,true);
      
                   }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-08
        • 2020-01-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多