User Guide

Window component 883
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 to 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:
obj.click = function(evt){
this.deletePopUp();
}
window.addEventListener("click", obj);
Note: 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.
Each component class has a version property, which is a class property. Class properties are
available only on the class itself. The
version property returns a string that indicates the version
of the component. To access this property, use the following code:
trace(mx.containers.Window.version);
Note: The code
trace(myWindowInstance.version); returns undefined.
Method summary for the Window class
The following table lists the method of the Window class.
Methods inherited from the UIObject class
The following table lists the methods the Window class inherits from the UIObject class. When
calling these methods from the Window object, use the form
WindowInstance.methodName.
Method Description
Window.deletePopUp() Removes a window instance created by
PopUpManager.createPopUp().
Method Description
UIObject.createClassObject() Creates an object on the specified class.
UIObject.createObject() Creates a subobject on an object.