// returns tree structure as XML typed as String, with no whitespace
var structure:String = tree.data;
// returns tree structure as XML typed as String, which is then converted to XML
var structure:String = tree.data;
var xml:XML = new XML(structure);
// returns tree structure as XML typed as String, with whitespace
var structure:String = tree.toString();
textfield.text = structure;
// returns the selected node's structure as XML typed as String, with no whitespace
var structure:String = tree.selectedNode.toXML();
var xml:XML = new XML(structure);
// returns the selected node's structure as XML typed as String, with whitespace
var structure:String = tree.selectedNode.toString();
textfield.text = structure;
// return node's name
trace(tree.selectedNode.nodeName);
// sets node's name
tree.selectedNode.nodeName = "user";
// return node's value
trace(tree.selectedNode.nodeValue);
// sets node's value
tree.selectedNode.nodeValue = "This is a text string.";
// sets a node's attribute value for "ID"
tree.selectedNode.attributes["ID"] = 500;
// sets a node's attribute value for "ID" (alternative)
tree.selectedNode.setAttribute("ID", 500);
// retrieves a node's attribute value for "ID"
var ID:Number = tree.selectedNode.attributes["ID"];
// retrieves a node's attribute value for "ID" (alternative)
var ID:Number = tree.selectedNode.getAttribute("ID");
// inserts a new node before the selected node
import com.flashloaded.ui.tree.nodes.TreeNode;
var selectedNode:TreeNode = tree.selectedNode;
var index:uint = selectedNode.findIndex();
var parent:TreeNode = selectedNode.parentNode;
var newNode:TreeNode = new TreeNode();
parentNode.addNodeAt(index, newNode);
tree.refresh();
// inserts a new node before the selected node (alternative and condensed)
import com.flashloaded.ui.tree.TreeNode;
tree.selectedNode.parentNode.addNodeAt(tree.selectedNode.index, new TreeNode());
tree.refresh();
// traces the level of the currently selected node
trace(tree.selectedNode.nodeLevel);
// runs through all of a node's children and deselects them
import com.flashloaded.ui.tree.nodes.TreeNode;
var children:Array = tree.selectedNode.childNodes;
for each (var node:TreeNode in children) {
tree.deselectNode(node);
}
// runs through all of a node's children and deselects them
var children:Array = tree.selectedNode.childNodes;
for (var i:uint = 0; i < tree.selectedNode.numChildren; i++) {
tree.deselectNode(children[i]);
}
// runs through all of a node's children and deselects them (alternative)
var children:Array = tree.selectedNode.childNodes;
var num:uint = tree.selectedNode.getNumChildren();
for (var i:uint = 0; i < num; i++) {
tree.deselectNode(children[i]);
}
// gets the select node's first child and closes it
tree.closeNode(tree.selectedNode.firtChild);
// gets the select node's parent and closes it
tree.closeNode(tree.selectedNode.parentNode);
// deselects all of a node's siblings
import com.flashloaded.ui.tree.nodes.TreeNode;
var siblings:Array = tree.selectedNode.siblings;
for each (var node:TreeNode in siblings) {
if (node == tree.selectedNode) continue;
tree.deselectNode(node);
}
// removes the node's previous sibling
tree.removeNode(tree.selectedNode.previousSibling);
// removes the node's next sibling
tree.removeNode(tree.selectedNode.nextSibling);
// finds the node with the ID of 123
import com.flashloaded.ui.tree.nodes.TreeNode;
var node:TreeNode = tree.findAttributeValue("ID", 123);
tree.selectAndOpen(node);
// finds the node with the ID of 123 in the first child of the root
import com.flashloaded.ui.tree.nodes.TreeNode;
var node:TreeNode = tree.rootNode.firstChild.findAttributeValue("ID", 123);
tree.selectAndOpen(node);
// finds the user node with the ID of 123 in the tree
import com.flashloaded.ui.tree.nodes.TreeNode;
var node:TreeNode = tree.findAttributeValueForNodeType("user", "ID", 123);
tree.selectAndOpen(node);
// finds the user node with the ID of 123 in the first child of the root
import com.flashloaded.ui.tree.nodes.TreeNode;
var node:TreeNode = tree.rootNode.firstChild.findAttributeValueForNodeType("user", "ID", 123);
tree.selectAndOpen(node);