header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
krishna
Points:260
Posts:0
Answered

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



1
Matt
Points: 0
Posts:0
Accepted Answer
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" >


2
Denley
Points: 0
Posts:0
Accepted Answer
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/


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+6 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions