width="600">
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);
}