Flex and AIR: open and close a window without re-creating
I would like to open and close a window in Flex (AIR). I would really like to do something like:
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)
I probably missed something simple, maybe close()
not what to use.
The main thing is that I want to create the window once and then show and hide it as needed.
EDIT: removed unnecessary vars
+2
Kekoa
source
to share
2 answers
It might be a copy error, but var
only required on the first line. Instead of closing the window, set the property to a visible
value false
to hide it.
//to hide the window
myWindow.visible = false;
//to show it again
myWindow.visible = true;
+3
Amarghosh
source
to share
Why is var at the beginning of each line?
try it
myWindow.close();
myWindow.activate();
myWindow.open();
or
myWindow.close(); myWindow = new Window(); myWindow.open();
-1
user111677
source
to share