The second usage example uses an
instance. The keyword
the component instance. For example, the following code, attached to the Window instance
myWindowComponent
on (mouseDownOutside) {
trace(this);
}
Example
The following example creates a window instance and defines a
that displays a message if the user clicks outside the window. You drag a Window component
from the Components panel to the current document's 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()
handler and must be attached directly to a Window
on()
, used inside an
this
, sends "_level0.myWindowComponent" to the Output panel:
handler attached to a component, refers to
on()
mouseDownOutside
Window.mouseDownOutside
handler
1485
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?