Close a TitleWindow with PopUpManager : PopupManager « Components « Flex






Close a TitleWindow with PopUpManager

Close a TitleWindow with PopUpManager
      
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:Script>
  

    import mx.managers.PopUpManager
    import mx.containers.TitleWindow;
    import mx.controls.TextArea;
    import mx.events.CloseEvent;

    private var _window:TitleWindow;

    private function showWindow(event:Event):void {
          var textArea:TextArea = new TextArea(  );
          textArea.text = "this is a test";
          textArea.height = 200;
          _window = TitleWindow(PopUpManager.createPopUp(this, TitleWindow));
          _window.addChild(textArea);
          _window.showCloseButton = true;
          _window.addEventListener(CloseEvent.CLOSE, closeHandler);
    }

      private function closeHandler(event:CloseEvent):void {
            PopUpManager.removePopUp(_window);
      }


  </mx:Script>

  <mx:Button id="button" label="Show Window" click="showWindow(event)" />

</mx:Application>

   
    
    
    
    
    
  








Related examples in the same category

1.Using TitleWindow and PopUpManager eventsUsing TitleWindow and PopUpManager events
2.Use PopUpManager to add and remove TitleWindowUse PopUpManager to add and remove TitleWindow
3.Create a TitleWindow with PopUpManagerCreate a TitleWindow with PopUpManager
4.Center a popup with PopUpManagerCenter a popup with PopUpManager
5.Create a pop-up with addPopUp() method and adds a Button controlCreate a pop-up with addPopUp() method and adds a Button control
6.Creates a pop-up with addPopUp() and adds a Button control to that window that closes the window when you click itCreates a pop-up with addPopUp() and adds a Button control to that window that closes the window when you click it