ActionScript 2.0 Components Language Reference |
|
|
|
| Tree component > Tree.setIcon() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
treeInstance.setIcon(node,linkID[,linkID2])
node An XML node.
linkID The linkage identifier of a symbol to be used as an icon beside the node. This parameter is used for leaf nodes and for the closed state of branch nodes.
linkID2 For a branch node, the linkage identifier of a symbol to be used as an icon that represents the open state of the node. This parameter is optional.
Nothing.
Method; specifies an icon for the specified node. This method takes one ID parameter (linkID) for leaf nodes and two ID parameters (linkID and linkID2) for branch nodes (the closed and open icons). For leaf nodes, the second parameter is ignored. For branch nodes, if you omit linkID2, the icon is used for both the closed and open states.
The following example adds two nodes to a Tree instance called my_tr and calls the setIcon() function to specify an icon in the library with a Linkage ID of imageIcon for the second node.
You must first add an instance of the Tree component to the Stage and name it my_tr and add an icon to the library with a Linkage ID of imageIcon; then add the following code to Frame 1.
/**Requires:- Tree component on Stage (instance name: my_tr)- Library item with Linkage ID of imageIcon*/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='2' /><node label='Outbox' data='3' /></node>");my_tr.dataProvider = trDP_xml;// Set movieclip as icon for 2nd node.my_tr.setIcon(my_tr.getTreeNodeAt(1), "imageIcon");
|
|
|
|