Add close handler to TitleWindow : TitleWindow « Container « Flex






Add close handler to TitleWindow

Add close handler to TitleWindow
     
<?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.Add close event listener for TitleWindowAdd close event listener for TitleWindow
2.Add Mouse Down listener to TitleWindowAdd Mouse Down listener to TitleWindow
3.Adding mouse event to Panel and TitleWindowAdding mouse event to Panel and TitleWindow
4.Creates a TitleWindow container inside a Panel container.Creates a TitleWindow container inside a Panel container.
5.Resize TitleWindow with TransitionResize TitleWindow with Transition
6.Change TitleWindow position and size in stateChange TitleWindow position and size in state
7.Add control to TitleWindowAdd control to TitleWindow
8.Make TitleWindow to show Close buttonMake TitleWindow to show Close button
9.Top level TitleWindow tag
10.TitleWindow Title, close button, position, border color and border alphaTitleWindow Title, close button, position, border color and border alpha
11.Add button to window through ActionScriptAdd button to window through ActionScript