1、创建一个component,继承自 TitleWindow,如:
Java代码
1.<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300"
2. showCloseButton="true" close="closeHandler()">
3. <mx:Script>
4. <![CDATA[
5. import mx.managers.PopUpManager;
6. private function closeHandler(): void{
7. PopUpManager.removePopUp(this);
8. }
9. ]]>
10. </mx:Script>
11.</mx:TitleWindow>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300"
showCloseButton="true" close="closeHandler()">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function closeHandler(): void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
</mx:TitleWindow> 需要注意的是当窗口关闭时要在popupmanager类中remove掉此窗口
2、在主程序中(即需要弹窗口的页面中),某个响应事件处(如button 的 click事件),添加如下代码:
Java代码
1.var win:MyTitleWindow = new MyTitleWindow();
2.win.x = 20;
3.win.y = 20;
4.PopUpManager.addPopUp(win,this,true);
[2011-04] flex弹出模式窗口
最新推荐文章于 2011-12-01 18:29:02 发布