ActionScript 2.0 Components Language Reference |
|
|
|
| Tree component > Tree.setIsBranch() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
treeInstance.setIsBranch(node,isBranch)
node An XML node.
isBranch A Boolean value indicating whether the node is (true) or is not (false) a branch.
Nothing.
Method; specifies whether the node has a folder icon and expander arrow and either has children or can have children. A node is automatically set as a branch when it has children; you only need to call setIsBranch() when you want to create an empty folder. You may want to create branches that don't yet have children if, for example, you only want child nodes to load when a user opens a folder.
Calling setIsBranch() refreshes any views.
The following example adds a single node to a Tree instance called my_tr and calls setIsBranch() to make it a branch without children.
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='Inbox' data='0'/>");
my_tr.dataProvider = trDP_xml;
// Set 1st node to be branch.
my_tr.setIsBranch(my_tr.getTreeNodeAt(0), true);
|
|
|
|