Use PopUpManager to add and remove TitleWindow : PopupManager « Components « Flex






Use PopUpManager to add and remove TitleWindow

Use PopUpManager to add and remove TitleWindow
      

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600"
    width="600">
    <mx:Script>
        
        import mx.containers.TitleWindow;
        import flash.events.*;
        import mx.managers.PopUpManager;
        import mx.controls.Button;
        import mx.core.IFlexDisplayObject;
        public var myTitleWindow:TitleWindow = new TitleWindow();
        
        public function openWindow(event:MouseEvent):void {
            myTitleWindow = new TitleWindow();
            myTitleWindow.title = "Window Title";
            myTitleWindow.width= 220;
            myTitleWindow.height= 150;

            var btn1:Button = new Button();
            btn1.label="close";
            btn1.addEventListener(MouseEvent.CLICK, closeTitleWindow);
            myTitleWindow.addChild(btn1);

            PopUpManager.addPopUp(myTitleWindow, this, true);
        }
        public function closeTitleWindow(event:MouseEvent):void {
            PopUpManager.removePopUp(event.currentTarget.parent);
        }
      
    </mx:Script>
    <mx:Button label="Open Window" click="openWindow(event);" />
</mx:Application>

   
    
    
    
    
    
  








Related examples in the same category

1.Using TitleWindow and PopUpManager eventsUsing TitleWindow and PopUpManager events
2.Create a TitleWindow with PopUpManagerCreate a TitleWindow with PopUpManager
3.Close a TitleWindow with PopUpManagerClose 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