/**
 * http://blog.flexexamples.com/2008/08/16/creating-an-undraggable-titlewindow-container-in-flex/
 */
package {
    import mx.containers.TitleWindow;
    import mx.controls.Label;
    import mx.core.ContainerLayout;
    import mx.core.IFlexDisplayObject;
    import mx.events.CloseEvent;
    import mx.events.FlexEvent;
    import mx.managers.PopUpManager;

    public class NonDraggableTitleWindow2 extends TitleWindow {
        public var lbl:Label;

        public function NonDraggableTitleWindow2() {
            super();
            init();
        }

        private function init():void {
            this.layout = ContainerLayout.ABSOLUTE;
            this.title = "TitleWindow";
            this.showCloseButton = true;
            this.width = 300;
            this.height = 200;
            this.addEventListener(FlexEvent.INITIALIZE, titleWin_initialize);
            this.addEventListener(CloseEvent.CLOSE, titleWin_close);

            lbl = new Label();
            lbl.text = "Drag this Window";
            lbl.setStyle("horizontalCenter", 0);
            lbl.setStyle("verticalCenter", 0);
            addChild(lbl);
        }

        private function titleWin_initialize(evt:FlexEvent):void {
            this.isPopUp = false;
        }

        private function titleWin_close(evt:CloseEvent):void {
            PopUpManager.removePopUp(evt.target as IFlexDisplayObject);
        }
    }
}