User Guide

788 Chapter 6: Components Dictionary
TreeDataProvider.addTreeNode()
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
Usage 1:
someNode.addTreeNode(label, data)
Usage 2:
someNode.addTreeNode(child)
Parameters
label
A string that displays the node.
data An object of any type that is associated with the node.
child Any XMLNode object.
Returns
The added XML node.
Description
Method; adds a child node at the root of the tree. The node is constructed either from the
information supplied in the
label and data parameters (Usage 1), or from the prebuilt child
node, which is an XMLNode object (Usage 2). Adding a preexisting node removes the node from
its previous location.
Calling this method refreshes the display of the tree.
Example
The first line of code in the following example locates the node to which to add a child. The
second line adds a new node to a specified node.
var myTreeNode = myTreeDP.firstChild.firstChild;
myTreeNode.addTreeNode("Inbox", 3);
The following code moves a node from one tree to the root of another tree:
myTreeNode.addTreeNode(mySecondTree.getTreeNodeAt(3));