TitleWindow in Flex4


 

TitleWindow in Flex4

Spark TitleWindow is a layout container that is created by used pop-up window. The TitleWindow container have a content area for own Childs, border, title bar etc. It is also have a close button that's working to close this TitleWindow.

Spark TitleWindow is a layout container that is created by used pop-up window. The TitleWindow container have a content area for own Childs, border, title bar etc. It is also have a close button that's working to close this TitleWindow.

TitleWindow in Flex4:

Spark TitleWindow is a layout container that is created by used pop-up window. The TitleWindow container have a content area for own Childs, border, title bar etc. It is also have a close button that's working to close this TitleWindow. If user want to a container that drag around the application window then use TitleWindow. If user want to create a TitleWindow then use PopUpManager to create TitleWindow. User not created directly using MXML tags.

In this example we have create a TitleWindow provide a user interface to enter user personal information. We have to create this TitleWindow with the help of PopUpManager and describe the functionality of close button. The PopUpManager provide methods createPopUp() and removePopUp() for create TitleWindow and remove TitleWindow.

Example:

In this example user have a main application code that provide a button. If user want to enter own personal information then click on this button and a title window are generate by the system and user fill information.

<?xml version="1.0"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Script>

<![CDATA[

import mx.managers.PopUpManager;

import spark.components.TitleWindow;

import myComponents.PersonalInformationForm;

private function createTitleWindow():void {

var personalInformationWindow:TitleWindow=

PopUpManager.createPopUp(this, PersonalInformationForm, false) as TitleWindow;

personalInformationWindow.title="Personal Information Window";

PopUpManager.centerPopUp(personalInformationWindow);

}

]]>

</fx:Script>

<s:Panel title="Create My Personal Information" width="200" height="100">

<s:Button label="Open Window" click="createTitleWindow();"/>

</s:Panel>

</s:Application>

 This is the main application code and TitleWindow component code is

<?xml version="1.0"?>

<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:s="library://ns.adobe.com/flex/spark"

close="close();">

0

<s:layout>

<s:VerticalLayout/>

</s:layout>

1

<fx:Script>

<![CDATA[

import mx.managers.PopUpManager;

2

private function close():void {

PopUpManager.removePopUp(this);

}

3

private function save():void {

PopUpManager.removePopUp(this);

}

4

]]>

</fx:Script>

<mx:Form>

5

<mx:FormItem label="First Name:">

<s:TextInput id="firstname" width="100%"/>

</mx:FormItem>

6

<mx:FormItem label="Last Name:">

<s:TextInput id="lastname" width="100%"/>

</mx:FormItem>

7

<mx:FormItem label="Email:">

<s:TextInput id="email" width="100%"/>

</mx:FormItem>

8

<mx:FormItem label="Age:">

<s:TextInput id="age" width="100%"/>

</mx:FormItem>

9

<mx:FormItem label="Contect Number:">

<s:TextInput id="contect" width="100%"/>

</mx:FormItem>

0

<mx:FormItem label="Address:">

<s:TextArea id="address" width="100%"/>

</mx:FormItem>

1

<mx:FormItem label="State:">

<s:TextInput id="state" width="100%"/>

</mx:FormItem>

2

<mx:FormItem label="Country:">

<s:TextInput id="country" width="100%"/>

</mx:FormItem>

3

</mx:Form>

<s:HGroup>

<s:Button label="Save"

4

click="save();" />

<s:Button label="Close without save" click="close();"/>

</s:HGroup>

5

</s:TitleWindow>

Output:

After click Open Window button a TitleWindow present like this.

6

 

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

7


Download personalinformation file code
Download titlewindow file code

Ads