Remove child from Panel
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init(event)"> <mx:Script> import mx.controls.Alert; import flash.events.MouseEvent; import flash.events.Event; public function init(e:Event):void { tw1.addEventListener(Event.CLOSE,closeWindow); } public function closeWindow(e:Event):void { p1.removeChild(tw1); } </mx:Script> <mx:Panel id="p1" title="Panel 1"> <mx:TitleWindow id="tw1" width="300" height="300" showCloseButton="true" title="Title Window 1"> <mx:Button label="Enter name" /> <mx:TextArea id="ta1" /> </mx:TitleWindow> </mx:Panel> </mx:Application>