Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1480912
  • 博文数量: 187
  • 博客积分: 10375
  • 博客等级: 上将
  • 技术积分: 3127
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-07 10:58
文章分类

全部博文(187)

文章存档

2013年(1)

2012年(8)

2011年(28)

2010年(36)

2009年(47)

2008年(67)

我的朋友

分类: 系统运维

2010-04-12 14:11:37

 
main.mxml
 
 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=""
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white">
  
    <mx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
  
            private function button_click(evt:MouseEvent):void {
                var popUpTitleWindow:PopUpTitleWindow = new PopUpTitleWindow();
                PopUpManager.addPopUp(popUpTitleWindow, this, true);
            }
        ]]>
    </mx:Script>
  
    <mx:Button id="button"
            label="Launch Window"
            click="button_click(event);" />
  
</mx:Application>

 

PopUpTitleWindow.mxml


 

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx=""
        showCloseButton="true"
        styleName="noPadding"
        layout="absolute"
        width="300"
        height="200"
        creationComplete="init();"
        resize="init();"
        close="titleWindow_close(event);"
        keyDown="titleWindow_keyDown(event);">
  
    <mx:Style>
        .noPadding {
            paddingBottom: 0;
            paddingTop: 0;
            paddingLeft: 0;
            paddingRight: 0;
        }
    </mx:Style>
  
    <mx:Script>
        <![CDATA[
            import mx.core.IFlexDisplayObject;
            import mx.events.CloseEvent;
            import mx.managers.PopUpManager;
  
            [Bindable]
            public var source:String;
  
            private function init():void {
                PopUpManager.centerPopUp(this);
                this.setFocus();
            }
  
            private function titleWindow_close(evt:CloseEvent):void {
                PopUpManager.removePopUp(evt.target as IFlexDisplayObject);
            }
  
            private function titleWindow_keyDown(evt:KeyboardEvent):void {
                if (evt.charCode == Keyboard.ESCAPE) {
                    this.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
                }
            }
        ]]>
    </mx:Script>
  
    <mx:Label id="lbl"
            text="Press ESC to close this window."
            fontWeight="bold"
            truncateToFit="true"
            horizontalCenter="0"
            verticalCenter="0" />
  
    <mx:ControlBar horizontalAlign="right" width="100%">
    </mx:ControlBar>
  
</mx:TitleWindow>


阅读(1936) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~