User Guide
Tree component (Flash Professional only) 781
}
myTreeInstance.addEventListener("nodeClose", listenerObject)
Description
Event; broadcast to all registered listeners when the nodes of a Tree component are closed
by a user.
Version 2 components use a dispatcher/listener event model. The Tree component broadcasts a
nodeClose event when one of its nodes is clicked closed; the event is handled by a function, also
called a handler, that is attached to a listener object (
listenerObject) that you create.
When the event is triggered, it automatically passes an event object (
eventObject) to the
handler. Each event object has properties that contain information about the event. You can use
these properties to write code that handles the event. The
Tree.nodeClose event’s event object
has one additional property:
node (the XML node that closed).
For more information, see “EventDispatcher class” on page 415.
Example
In the following example, a handler called myTreeListener is defined and passed to the
myTree.addEventListener() method as the second parameter. The event object is captured by
the
nodeClose handler in the evtObject parameter. When the nodeClose event is broadcast, a
trace statement is sent to the Output panel.
myTreeListener = new Object();
myTreeListener.nodeClose = function(evtObject){
trace(evtObject.node + " node was closed");
}
myTree.addEventListener("nodeClose", myTreeListener);
Tree.nodeOpen
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
listenerObject = new Object();
listenerObject.nodeOpen = function(eventObject){
// insert your code here
}
myTreeInstance.addEventListener("nodeOpen", listenerObject)
Description
Event; broadcast to all registered listeners when a user opens a node on a Tree component.