Flash 8 Documentation |
|||
| Components Language Reference > 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.
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 |
The following table lists the method of the Window class.
|
Method |
Description |
|---|---|
|
Removes a window instance created by PopUpManager.createPopUp(). |
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 |
|---|---|
|
Creates an object on the specified class. |
|
|
Creates a subobject on an object. |
|
|
Destroys a component instance. |
|
|
Calls a function when parameters have been set in the Property and Component inspectors. |
|
|
Gets the style property from the style declaration or object. |
|
|
Marks the object so it is redrawn on the next frame interval. |
|
|
Moves the object to the requested position. |
|
|
Forces validation of the object so it is drawn in the current frame. |
|
|
Resizes the object to the requested size. |
|
|
Sets a skin in the object. |
|
|
Sets the style property on the style declaration or object. |
The following table lists the methods the Window class inherits from the UIComponent class. When calling these methods from the Window object, use the form WindowInstance.methodName.
|
Method |
Description |
|---|---|
|
Returns a reference to the object that has focus. |
|
|
Sets focus to the component instance. |
The following table lists properties of the Window class.
|
Property |
Description |
|---|---|
|
Indicates whether a close button is ( |
|
|
A reference to the content (root movie clip) of the window (read-only). |
|
|
Sets the name of the content to display in the window. |
|
|
The text that appears in the title bar. |
|
|
The style declaration that formats the text in the title bar. |
The following table lists the properties the Window class inherits from the UIObject class. When accessing these properties from the Window object, use the form WindowInstance.propertyName.
|
Property |
Description |
|---|---|
|
Read-only; the position of the bottom edge of the object, relative to the bottom edge of its parent. |
|
|
Read-only; the height of the object, in pixels. |
|
|
Read-only; the left edge of the object, in pixels. |
|
|
Read-only.The position of the right edge of the object, relative to the right edge of its parent. |
|
|
A number indicating the scaling factor in the x direction of the object, relative to its parent. |
|
|
A number indicating the scaling factor in the y direction of the object, relative to its parent. |
|
|
Read-only; the position of the top edge of the object, relative to its parent. |
|
|
A Boolean value indicating whether the object is visible ( |
|
|
Read-only; the width of the object, in pixels. |
|
|
Read-only; the left edge of the object, in pixels. |
|
|
Read-only; the top edge of the object, in pixels. |
The following table lists the properties the Window class inherits from the UIComponent class. When accessing these properties from the Window object, use the form WindowInstance.propertyName.
|
Property |
Description |
|---|---|
|
Indicates whether the component can receive focus and input. |
|
|
A number indicating the tab order for a component in a document. |
The following table lists the events of the Window class.
|
Event |
Description |
|---|---|
|
Broadcast when the close button is clicked (released). |
|
|
Broadcast when a window is created. |
|
|
Broadcast when the mouse is clicked (released) outside the modal window. |
The following table lists the events the Window class inherits from the UIObject class.
|
Event |
Description |
|---|---|
|
Broadcast when an object is about to draw its graphics. |
|
|
Broadcast when an object's state changes from visible to invisible. |
|
|
Broadcast when subobjects are being created. |
|
|
Broadcast when the object has moved. |
|
|
Broadcast when an object has been resized. |
|
|
Broadcast when an object's state changes from invisible to visible. |
|
|
Broadcast when the subobjects are being unloaded. |
The following table lists the events the Window class inherits from the UIComponent class.
|
Event |
Description |
|---|---|
|
Broadcast when an object receives focus. |
|
|
Broadcast when an object loses focus. |
|
|
Broadcast when a key is pressed. |
|
|
Broadcast when a key is released. |
Version 8
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00004296.html