<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" fontSize="14"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.containers.TitleWindow; import mx.events.FlexMouseEvent; private var helpWindow:TitleWindow; private function showLogin():void { //创建弹出窗口,false表示,其他组件现在可见。 helpWindow = TitleWindow(PopUpManager.createPopUp(this, title2, false)); //鼠标点击外部时,关闭窗口 helpWindow.addEventListener("mouseDownOutside", removeForm); } private function removeForm(event:FlexMouseEvent):void { PopUpManager.removePopUp(helpWindow); } ]]> </mx:Script> <mx:VBox width="300" height="300"> <mx:Button click="showLogin();" label="click here to show TitleWindow"/> </mx:VBox> </mx:Application>
?
<?xml version="1.0"?> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="提示?" showCloseButton="true" close="removeMe()" fontSize="14"> <!--close="removeMe()"设置关闭窗口--> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; private function removeMe():void { PopUpManager.removePopUp(this); } ]]> </mx:Script> <mx:Text text="text"/> <mx:Button label="blabel" click="removeMe()"/> </mx:TitleWindow>
?