User Guide
Tree.addTreeNode() 1285
Tree.addTreeNode()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
Usage 1:
treeInstance.addTreeNode(label [, data])
Usage 2:
treeInstance.addTreeNode(child)
Parameters
label A string that displays the node, or an object with a label field (or whatever label field
name is specified by the
labelField property).
data An object of any type that is associated with the node. This parameter is optional.
child Any XMLNode object.
Returns
The added XML node.
Description
Method; adds a child node to 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 view.
Example
The following example creates two Tree components with a node for each one, 1st Local
Folders
and 2nd Local Folders, respectively. Then it adds the tree node (2nd Local
Folders
) from the second Tree to the first Tree and also adds a new node, Inbox.
You must first add the component to the document library by dragging a Tree component to
the Stage and then deleting it; then add the following code to Frame 1.
TIP
First try this example without the two addTreeNode() statements at the end; then try the
full example.