Tree.getNodeDisplayedAt()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

treeInstance.getNodeDisplayedAt(index)

Parameters

index An integer representing the display position in the viewable area of the tree. This number is zero-based; the node at the first position is 0, second position is 1, and so on.

Returns

The specified XMLNode object.

Description

Method; maps a display index of the tree onto the node that is displayed there. For example, if the fifth row of the tree showed a node that is eight levels deep into the hierarchy, that node would be returned by a call to getNodeDisplayedAt(4).

The display index is an array of items that can be viewed in the tree window. For example, any children of a closed node are not in the display index. The display index starts with 0 and proceeds through the visible items regardless of parent. In other words, the display index is the row number, starting with 0, of the displayed rows.

NOTE

Display indices change every time nodes open and close.

Example

The following example adds a node to a Tree instance called my_tr and then calls the getNodeDisplayedAt() method to retrieve the node at display position 0 (zero). The example calls the trace() function to display the node.

You must first add an instance of the Tree component to the Stage and name it my_tr; then 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\" />");
my_tr.dataProvider = trDP_xml;

trace(my_tr.getNodeDisplayedAt(0));