- Home /
 
               Question by 
               flashtech · Mar 12, 2010 at 10:39 AM · 
                guigui-window  
              
 
              Please! How can i close a GUI-Wndows or Button in Javascript?
How can I via button click to close a GUI window. In other words, How can I make it with one click, you can close a GUI window.
Thanks
               Comment
              
 
               
              Answer by Lipis · Mar 12, 2010 at 01:10 PM
Here is a little example on how GUI.Window() works and how you can close a window by simply not drawing it. Just add this script to an empty object to see it action.
var showWindow: boolean = true;
 
               function OnGUI () { showWindow = GUI.Toggle (Rect (16, 16, 128, 24), showWindow, "Show My Window");
  if (showWindow) {
     GUI.Window (0, Rect (128, 64, 256, 128), MyWindow, "My Window");
 }
 }
 function MyWindow (windowID : int) { GUI.Label(Rect (64, 32, 128, 24), "Hello, world!"); if (GUI.Button (Rect (64, 64, 128, 24), "Close")) { showWindow = false; } } 
If you go through the GUI Scripting Guide you'll have a better understanding on this matter.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                