  | | | Tree component | Tree component 2004-02-27 - By Brook Davies
Back Hello,
I am trying to get a tree component to 'show up'. I copied and pasted the code from this article http://www.macromedia.com/devnet/mx/trio/articles/tree_control03.html, (See below) and dragged a tree component onto the stage and named it 'myTree_tree'.
When I test this, nothing shows up, just the empty listbox thing. I traced the tree component and it returned a reference to it - so its named correctly.
Does anyone have any very simple tree code that I can test just to get the tree to 'show up' ?
Brook
// This code will create a simple, static tree.
// Set the root node to display "Parts List" and be initially open. // To do this we create a new tree node object in a variable called // 'myRootNode' and then pass it to myTree_tree through the // setRootNode() method of the Tree Control component. var myRootNode = new FTreeNode("Parts List").setIsOpen(true); myTree_tree.setRootNode(myRootNode);
// Next set the first parent node by creating another node object // in a variable called 'parentnode1' and passing it to myRootNode // through the addNode() method of the Tree Control component. var parentnode1 = new FTreeNode("All Wheel Drive","parentnode1data"); myRootNode.addNode(parentnode1);
// We'll repeat the process to create a child node, passing the node // object to the parentnode1 we just created. var childnode1 = new FTreeNode("Axel Shaft","childnode1 data"); parentnode1.addNode(childnode1);
// The next two addNode() routines simply repeat the procedure above // to build out the tree with more parts. var parentnode2 = new FTreeNode("Cooling","parentnode2 data"); myRootNode.addNode(parentnode2);
var childnode2 = new FTreeNode("Pump Block","childnode2 data"); parentnode2.addNode(childnode2);
// Finally, we need to refresh the tree to display the node we created. myTree_tree.refresh();
<html> <body> Hello, <br><br> I am trying to get a tree component to 'show up'. I copied and pasted the code from this article <a href="http://www.macromedia.com/devnet/mx/trio/articles/tree_control03.html" eudora="autourl">http://www.macromedia.com/devnet/mx/trio/articles/tree _control03.html</a>, (See below) and dragged a tree component onto the stage and named it '<font size=2>myTree_tree'.<br><br> </font>When I test this, nothing shows up, just the empty listbox thing. I traced the tree component and it returned a reference to it - so its named correctly. <br><br> Does anyone have any very simple tree code that I can test just to get the tree to 'show up' ?<br><br> Brook<br><br> <br> <font size=2>// This code will create a simple, static tree. <br><br> // Set the root node to display "Parts List" and be initially open. <br> // To do this we create a new tree node object in a variable called // 'myRootNode' and then pass it to myTree_tree through the <br> // setRootNode() method of the Tree Control component. <br> var myRootNode = new FTreeNode("Parts List").setIsOpen(true); <br> myTree_tree.setRootNode(myRootNode); <br><br> // Next set the first parent node by creating another node object <br> // in a variable called 'parentnode1' and passing it to myRootNode <br> // through the addNode() method of the Tree Control component. <br> var parentnode1 = new FTreeNode("All Wheel Drive","parentnode1data");<br> myRootNode.addNode(parentnode1); <br><br> // We'll repeat the process to create a child node, passing the node<br> // object to the parentnode1 we just created. <br> var childnode1 = new FTreeNode("Axel Shaft","childnode1 data");<br> parentnode1.addNode(childnode1); <br><br> // The next two addNode() routines simply repeat the procedure above<br> // to build out the tree with more parts. <br> var parentnode2 = new FTreeNode("Cooling","parentnode2 data"); <br> myRootNode.addNode(parentnode2); <br><br> var childnode2 = new FTreeNode("Pump Block","childnode2 data"); <br> parentnode2.addNode(childnode2); <br><br> // Finally, we need to refresh the tree to display the node we created. <br> myTree_tree.refresh();<br> </font></body> </html>
|
|
 |