Make TitleWindow to show Close button
<?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