User Guide

Window.mouseDownOutside 1485
The second usage example uses an on() handler and must be attached directly to a Window
instance. The keyword
this, used inside an on() handler attached to a component, refers to
the component instance. For example, the following code, attached to the Window instance
myWindowComponent, sends “_level0.myWindowComponent” to the Output panel:
on (mouseDownOutside) {
trace(this);
}
Example
The following example creates a window instance and defines a mouseDownOutside handler
that displays a message if the user clicks outside the window. You drag a Window component
from the Components panel to the current documents library, and then add the following
code to Frame 1:
/**
Requires:
- Window component in library
*/
import mx.managers.PopUpManager;
import mx.containers.Window;
System.security.allowDomain("http://www.flash-mx.com");
// Create window.
var my_win:MovieClip = PopUpManager.createPopUp(this, Window, true,
undefined, true);
// Create a listener object.
var winListener:Object = new Object();
winListener.mouseDownOutside = function(evt_obj:Object)
{
trace("mouseDownOutside event triggered.");
}
// Add listener.
my_win.addEventListener("mouseDownOutside", winListener);
See also
EventDispatcher.addEventListener()