User Guide
1472 Window component
Window class
Inheritance MovieClip > UIObject class > UIComponent class > View > ScrollView >
Window
ActionScript Class Name mx.containers.Window
The properties of the Window class let you do the following at runtime: set the title caption,
add a close button, and set the display content. Setting a property of the Window class with
ActionScript overrides the parameter of the same name set in the Property inspector or
Component Inspector panel.
The best way to instantiate a window is to call
PopUpManager.createPopUp(). This method
creates a window that can be modal (overlapping and disabling existing objects in an
application) or nonmodal. For example, the following code creates a modal Window instance
(the last parameter indicates modality):
var newWindow = PopUpManager.createPopUp(this, Window, true);
Flash simulates modality by creating a large transparent window underneath the Window
component. Because of the way transparent windows are rendered, you may notice a slight
dimming of the objects under the transparent window. You can set the effective transparency
by changing the
_global.style.modalTransparency value from 0 (fully transparent) to
100 (opaque). If you make the window partially transparent, you can also set the color of the
window by changing the Modal skin in the default theme.
If you use
PopUpManager.createPopUp() to create a modal window, you must call
Window.deletePopUp() to remove it so that the transparent window is also removed. For
example, if you use the close button in the window, you would write the following code:
var win = PopUpManager.createPopUp(_root, Window, true,
{closeButton:true});
function click(evt){
evt.target.deletePopUp();
}
win.addEventListener("click", this);
Code does not stop executing when a modal window is created. In other environments (for
example, Microsoft Windows), if you create a modal window, the lines of code that follow the
creation of the window do not run until the window is closed. In Flash, the lines of code are
run after the window is created and before it is closed.