MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1296

Components language reference
Table of Contents

Advertisement

Description
Method; returns the display index of the node specified in the
The display index indicates the item's position in the list of items that are visible in the tree
window. For example, any children of a closed node are not in the display index. The list of
display indices starts with 0 and proceeds through the visible items regardless of parent. In
other words, the index is the row number, starting with 0, of the displayed rows.
Example
The following example adds six nodes to a Tree and calls
position of the node that the user selects.
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, 140);
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='0' /><node
label='Outbox' data='1' /></node><node label='3rd Local Folders'><node
label='Inbox' data='0' /><node label='Outbox' data='1' /></node><node
label='4th Local Folders'><node label='Inbox' data='0' /><node
label='Outbox' data='1' /></node><node label='5th Local Folders'><node
label='Inbox' data='0' /><node label='Outbox' data='1' /></node><node
label='6th Local Folders'><node label='Inbox' data='0' /><node
label='Outbox' data='1' /></node>");
my_tr.dataProvider = trDP_xml;
my_tr.firstVisibleNode = my_tr.getTreeNodeAt(0);
my_tr.addEventListener("change", listChanged);
function listChanged(evt_obj:Object) {
trace(my_tr.getDisplayIndex(evt_obj.target.selectedNode));
}
1292
Tree component (Flash Professional only)
parameter.
node
getDisplayIndex()
to display the
; then
my_tr

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents