【问题标题】:Flex and AIR: Open and Close Window Without Re-creatingFlex 和 AIR:无需重新创建即可打开和关闭窗口
【发布时间】:2009-10-08 00:57:42
【问题描述】:

我想在 Flex(AIR) 中打开和关闭一个窗口。我真的很想做这样的事情:

var myWindow:Window = new Window();
myWindow.open(true); // open after creating(this works)

myWindow.close(); // now hide the window

myWindow.open(true);// reappear(this doesn't work after a close)

我可能遗漏了一些简单的东西,也许 close() 不是应该使用的。

主要是我想创建一个窗口一次,然后根据需要显示和隐藏它。

编辑:删除不必要的变量

【问题讨论】:

    标签: apache-flex air


    【解决方案1】:

    可能是复制粘贴错误,但var 仅在第一行是必需的。不要关闭窗口,而是将其visible 属性设置为false 以隐藏它。

    //to hide the window
    myWindow.visible = false;
    
    //to show it again
    myWindow.visible = true;
    

    【讨论】:

      【解决方案2】:

      为什么每行的开头都是 var?

      试试

      myWindow.close(); 
      myWindow.activate();
      myWindow.open();
      

      或

      myWindow.close(); 
      myWindow = new Window();
      myWindow.open();
      

      【讨论】:

        猜你喜欢
        • 2014-09-25
        • 1970-01-01
        • 1970-01-01
        • 2020-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多