![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
You can use a window in an application whenever you need to present a user with information or a choice that takes precedence over anything else in the application. For example, you might need a user to fill out a login window, or a window that changes and confirms a new password.
There are several ways to add a window to an application. You can drag a window from the Components panel to the Stage. You can also use call createClassObject()
(see UIObject.createClassObject()
) to add a window to an application. The third way of adding a window to an application is to use the PopUpManager class. Use the PopUpManager to create modal windows that overlap other objects on the Stage. For more information, see Window class.
The following are authoring parameters that you can set for each Window component instance in the Property inspector or in the Component Inspector panel:
contentPath specifies the contents of the window. This can be the linkage identifier of the movie clip or the symbol name of a screen, form, or slide that contains the contents of the window. This can also be an absolute or relative URL for a SWF or JPG file to load into the window. The default value is "". Loaded content clips to fit the Window.
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 doesn't 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
.
You can write ActionScript to control these and additional options for Window components using its properties, methods, and events. For more information, see Window class.
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.
buttonListener = new Object(); buttonListener.click = function(){ mx.managers.PopUpManager.createPopUp(_root, mx.containers.Window, true, { title:"Change Password", contentPath:"PasswordForm" }) } button.addEventListener("click", buttonListener);
This handler calls PopUpManager.createPopUp()
to instantiate a Window component with the title bar "Change Password" that displays the contents of the PasswordForm movie clip.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |