User Guide
Window component 889
A component instance (windowInstance) dispatches an event (in this case, complete) and the
event is handled by a function, also called a handler, on a listener object (
listenerObject) that
you create. You define a method with the same name as the event on the listener object; the
method is called when the event is triggered. When the event is triggered, it automatically passes
an event object (
eventObject) to the listener object method. The event object has properties that
contain information about the event. You can use these properties to write code that handles the
event. Finally, you call the
EventDispatcher.addEventListener() method on the component
instance that broadcasts the event to register the listener with the instance. When the instance
dispatches the event, the listener is called.
For more information, see “EventDispatcher class” on page 415.
Example
The following example creates a window and then defines a complete handler that resizes the
window to fit its contents. (This code would be placed on Frame 1 of the component in the
library.)
import mx.managers.PopUpManager
import mx.containers.Window
var myTW = PopUpManager.createPopUp(_root, Window, true, {title:"Password
Change", contentPath: "PasswordForm"});
lo = new Object();
lo.handleEvent = function(evtObj){
if(evtObj.type == "complete"){
_root.myTW.setSize(myTW.content._width, myTW.content._height + 25);
}
}
myTW.addEventListener("complete", lo);
See also
EventDispatcher.addEventListener()
Window.content
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
windowInstance.content
Description
Property; a reference to the content (root movie clip) of the window. This property returns a
MovieClip object. When you attach a symbol from the library, the default value is an instance of
the attached symbol. When you load content from a URL, the default value is
undefined until
the load operation has started.