代码之家  ›  专栏  ›  技术社区  ›  Kekoa

弹性和空气:打开和关闭窗口,无需重新创建

  •  2
  • Kekoa  · 技术社区  · 15 年前

    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()

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

    编辑:删除不必要的变量

    2 回复  |  直到 15 年前
        1
  •  3
  •   Amarghosh    15 年前

    可能是复制粘贴错误,但是 var visible 财产 false 把它藏起来。

    //to hide the window
    myWindow.visible = false;
    
    //to show it again
    myWindow.visible = true;
    
        2
  •  -1
  •   user111677    15 年前

    为什么每行开头都有var?

    尝试

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

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