Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Flex Container TitleWindow layout container

Related Tutorials


 
 

Share on Google+Share on Google+

TitleWindow layout container

Advertisement
TitleWindow container is much like panel container.

TitleWindow layout container

     

TitleWindow container is much like panel container. It provides title bar, border, content area as panel container does. The added features the TitleWindow delivers is that it can display close button and can work as pop up window. The pop up window can be dragged around the application window. PopUpManager is used to open and remove the TitleWindow as pop up. The value of attribute "showCloseButton" can be set to true to show close button in popup window. To add popup window, use addPopUp() method and to close the window use removePopUp() method of PopUpManager class.

TitleWindowLayoutContainer.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="354" height="212">

<mx:Script>

<![CDATA[

import mx.managers.PopUpManager;

import mx.containers.TitleWindow;

import mx.controls.Label;

public function showTitleWindow():void{

var newTitleWindow:NewTitleWindow = new NewTitleWindow();

newTitleWindow.showCloseButton = true;

PopUpManager.addPopUp(newTitleWindow,this,true);

PopUpManager.centerPopUp(newTitleWindow);

}

]]>

</mx:Script>

<mx:Button label="Click Me !" click="showTitleWindow();" horizontalCenter="0" verticalCenter="0"/>

</mx:Application>

NewTitleWindow.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Title" status="Status" width="200" height="200" close="title_close();">

<mx:Style>

.windowStyles {

color: red;

letterSpacing: 2;

}

.windowStatus {

color: blue;

fontWeight: bold;

}

</mx:Style>

<mx:Script>

<![CDATA[

import mx.managers.PopUpManager;

public function title_close():void{

PopUpManager.removePopUp(this);

}

]]>

</mx:Script>

<mx:Label text="This is Title Window" width="162"/>

<mx:Button label="OK" click="PopUpManager.removePopUp(this);"/>

</mx:TitleWindow>

Watch in action:

Dowload the code

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 14, 2009

Related Tutorials

Discuss: TitleWindow layout container  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com