MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1302

Components language reference
Table of Contents

Advertisement

When the event is triggered, it automatically passes an event object (
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
object has one additional property:
For more information, see
Example
The following example adds two nodes to the Tree instance
listener objects, one for
occur, the listener function uses a trace statement to display the event and the affected node in
the Output panel.
You must first add an instance of the Tree component to the Stage and name it
add the following code to Frame 1.
/**
Requires:
- Tree component on Stage (instance name: my_tr)
*/
var my_tr:mx.controls.Tree;
my_tr.setSize(200, 100);
var trDP_xml:XML = new XML("<node label='1st Local Folders'><node
label='Inbox' data='0'/><node label='Outbox' data='1'/></node><node
label='2nd Local Folders'><node label='Inbox' data='2'/><node
label='Outbox' data='3'/></node>");
my_tr.dataProvider = trDP_xml;
// Create listener object.
var trListener:Object = new Object();
trListener.nodeOpen = function(evt_obj:Object){
trace("Node opened\n" + evt_obj.node);
trace("\n");
}
trListener.nodeClose = function(evt_obj:Object){
trace("Node closed\n" + evt_obj.node);
trace("\n");
}
// Add listeners.
my_tr.addEventListener("nodeOpen", trListener);
my_tr.addEventListener("nodeClose", trListener);
1298
Tree component (Flash Professional only)
(the XML node that closed).
node
"EventDispatcher class" on page
events and one for
nodeOpen
eventObject
Tree.nodeClose
499.
, and then creates two
my_tr
events
When these events
nodeClose
.
) to the
event's event
; then
my_tr

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents