flex titleWindow添加最小化和最大化按纽as
2012-01-10 13:52
295 查看
package com.talkyun.rheaui.model { //MyWindow作用是为titleWindow添加窗体的最小化和最大化的功能 import flash.events.MouseEvent; import mx.containers.TitleWindow; import mx.controls.Button; public class MyWindow extends TitleWindow { public function MyWindow() { super(); this.showCloseButton=true; } protected var maxSizeButton:Button; //最大化按钮 protected var minSizeButton:Button; //最小化按钮 //正常状态下窗口的大小、位置 protected var normalX:int,normalY:Number,normalWidth:int,normalHeight:int; //初始状态 protected var winState:String="normal"; override protected function createChildren():void { super.createChildren(); //创建最大化按钮 this.maxSizeButton=new Button(); this.maxSizeButton.width=this.maxSizeButton.height=16; this.maxSizeButton.y=6; //添加最大化事件 this.maxSizeButton.addEventListener(MouseEvent.CLICK,OnMaxSize); this.titleBar.addChild(this.maxSizeButton); //创建最小化按钮 this.minSizeButton=new Button(); this.minSizeButton.width=this.minSizeButton.height=16; this.minSizeButton.y=6; //添加最小化事件 this.minSizeButton.addEventListener(MouseEvent.CLICK,OnMinSize); this.titleBar.addChild(this.minSizeButton); } protected function OnMaxSize(e:MouseEvent):void { if(winState=="normal") { //保存正常状态下窗口位置、大小 normalX=this.x; normalY=this.y; normalHeight=this.height; normalWidth=this.width; //设置为最大化状态 this.x=0; this.y=0; this.percentHeight=1200; this.percentWidth=1000; //最大化状态 this.winState="max"; } else if(this.winState=="max") { //恢复正常状态下窗口位置、大小 this.x=this.normalX; this.y=this.normalY; this.width=this.normalWidth; this.height=this.normalHeight; //正常状态 this.winState="normal"; } } protected function OnMinSize(e:MouseEvent):void { //最小化,简单隐藏 this.visible=false; } override protected function layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void { super.layoutChrome(unscaledWidth,unscaledHeight); //设置两个新添的按钮的位置 this.maxSizeButton.x=this.titleBar.width-43; this.minSizeButton.x=this.titleBar.width-60; //调整状态文本的位置,左移一段位置 this.statusTextField.x-=32; } } }
相关文章推荐
- flex titleWindow添加最小化和最大化按纽as
- FLEX4 TitleWindow 添加帮组按钮(最大化、最小化相同)使用皮肤更改
- 实现最大化、最小化、缩放功能的TitleWindow
- flex学习笔记 皮肤(五) 为titlewindow标题栏添加可以操作的子项
- 窗体添加 "最大化","最小化","还原" 事件
- Fedora 16 添加最大化,最小化按钮
- flex TitleWindow之间数据传输的示例
- Flex利用titleIcon属性给Panel容器标题部添加一个ICON图标
- Flex 自定义组件 -- 弹出窗口 [PopUpManager TitleWindow 组件]的使用
- 界面添加弹出菜单 隐藏主界面的菜单栏 隐藏右上角最大化最小化按钮
- Flex中在弹出TitleWindow中动态刷新父面板
- vba窗体添加最大化最小化按钮,并且可以运行时调整大小
- Flex 4 - TitleWindow + Display Icon
- Flex中TitleWindow自定义CloseButton问题
- flex中TitleWindow滚动条问题
- flex 非模态的titlewindow,点击titlewindow外部时的事件
- MFC对话框添加菜单项,最大化,最小化
- Flex的Resizable TitleWindow
- QDialog 添加最大化、最小化按钮和关闭按钮,并且要正常显示
- Flex中如何通过showCloseButton属性控制TitleWindow右上角关闭按钮有效/无效的例子