User Guide

Window component 879
title indicates the title of the window.
closeButton indicates whether a close button is displayed (true) or not (false). Clicking the
close button broadcasts a
click event, but doesnt close the window. You must write a handler
that calls
Window.deletePopUp() to explicitly close the window. For more information about the
click event, see Window.click.
Note: If a window was created by means other than the PopUp Manager, you can’t close it.
You can write ActionScript to control these and additional options for the Window component
using its properties, methods, and events. For more information, see “Window class
on page 882.
Creating an application with the Window component
The following procedure explains how to add a Window component to an application. In this
example, the window asks a user to change her password and confirm the new password.
To create an application with the Window component:
1.
Create a new movie clip that contains password and password confirmation fields, and OK and
Cancel buttons. Name the movie clip PasswordForm.
This is the content that will fill the window. The content should be aligned at 0,0 because it is
positioned in the upper left corner of the window.
2.
In the library, select the PasswordForm movie clip and select Linkage from the Library options
menu.
3.
Select Export for ActionScript.
The linkage identifier PasswordForm is automatically entered in the Identifier box.
4.
Enter mx.core.View in the class field and click OK.
5.
Drag a Window component from the Components panel to the Stage and delete the
component from the Stage. This adds the component to the library.
6.
In the library, select the Window SWC file and select Linkage from the Library options menu.
7.
Select Export for ActionScript.
8.
Drag a button component from the Components panel to the Stage; in the Property inspector,
give it the instance name button.
9.
Open the Actions panel, and enter the following click handler on Frame 1:
buttonListener = new Object();
buttonListener.click = function(){
myWindow = mx.managers.PopUpManager.createPopUp(_root,
mx.containers.Window, true, {title:"Change Password",
contentPath:"PasswordForm"});
myWindow.setSize(240,110);
}
button.addEventListener("click", buttonListener);