ActionScript 2.0 Components Language Reference |
|
|
|
| Tree component > Tree.firstVisibleNode | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
treeInstance.firstVisibleNode =someNode
Property; indicates the first node that is visible at the top of the tree display. Use this property to scroll the tree display to a desired position. If the specified node someNode is within a node that hasn't been expanded, setting firstVisibleNode has no effect. The default value is the first visible node or undefined if there is no visible node. The value of this property is an XMLNode object.
This property is an analogue to the List.vPosition property.
The following example populates a Tree component called my_tr with six nodes that it creates from a string of XML text. It makes the last node visible in the Tree by assigning the last node (relative position 5) to the firstVisibleNode property. You can make other nodes visible by changing 5 to other values from 0 to 4.
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' /><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;
// Set visible node to last node.
my_tr.firstVisibleNode = my_tr.getTreeNodeAt(5);
|
|
|
|