5/21/2010 2:40:28 AM
Title:
Title window
Hi Everybody,
I have a title window, By default In title window we will get close icon, and i want max,min option in title window, Please anybody help me.
Thanks & Regards,
krishna
5/21/2010 5:45:41 AM
use this class to extend the TitleWindow class and add the functionality to add a minimize Maximise button in Title Window. Class name is MinMaxTitleWindow.as
package
{
import flash.display.DisplayObject;
import flash.events.Event;
import mx.containers.TitleWindow;
import mx.controls.Button;
public class MinMaxTitleWindow extends TitleWindow
{
public var btnMinMax:Button;
public function MinMaxTitleWindow()
{
super();
}
protected override function createChildren(): void {
super.createChildren();
btnMinMax = new Button();
btnMinMax.name = "btnMinMax";
//to use minimise and maximise icons uncomment the below lines and
//also declare the icon styles in your stylesheet
//btnMinMax.setStyle("overIcon",buttonUpIcon);
//btnMinMax.setStyle("downIcon",buttonUpIcon);
//btnMinMax.setStyle("upIcon",buttonUpIcon);
btnMinMax.visible=true;
//you can comment the width height if using icons
btnMinMax.width=20;
btnMinMax.height=20;
rawChildren.addChild(btnMinMax);
btnMinMax.addEventListener("click",switchStateIcon);
}
private var styleFlag=0;
private function switchStateIcon(event:Event) :void{
if(styleFlag==0){
//btnMinMax.setStyle("overIcon",buttonDownIcon);
styleFlag = 1;
}
else{
//btnMinMax.setStyle("overIcon",buttonUpIcon);
styleFlag = 0;
}
}
protected override function updateDisplayList(unscaledWidth: Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(unscaledWidth > 0){
this.visible = true;
} else {
this.visible = false
}
var upAsset:DisplayObject = btnMinMax.getChildByName("upIcon");
var margin:int = 4;
var pixelsFromTop:int = 5;
var pixelsFromRight:int = 30;
var buttonWidth:int=btnMinMax.width;
var x:Number = unscaledWidth - buttonWidth - pixelsFromRight;
var y:Number = pixelsFromTop;
btnMinMax.move(x, y);
}
}
}
To use this class :
//in actionscript use the event listener to add the button click event ans minimise and maximise the window
minMaxTitle.btnMinMax.addEventListener(MouseEvent.CLICK,miniMizeFunction)
private function miniMizeFunction(evt:Event):void{
// add your minimise and maximise code here
}
//in mxml
<local:MinMaxTitleWindow id="minMaxTitle" width="200" height="200" showCloseButton="true" >
5/21/2010 6:42:39 AM
check this link for a minimize maximize component
http://nisheet.wordpress.com/2007/04/28/resizable-title-window/