ADVANCEDTREE METHODS
closeAll
Availability
Flash Player 9.
Description
Closes all nodes in the tree.
Arguments
None
Returns
Nothing
Example
tree.closeAll();
closeNode
Availability
Flash Player 9.
Description
Closes the specified node in the tree if it is currently displayed.
Arguments
closeNode(node:TreeNode)
Returns
Nothing
Example
tree.closeNode(tree.selectedNode);
deselectAll
Availability
Flash Player 9.
Description
Deslects all selected nodes in the tree.
Arguments
None
Returns
Nothing
Example
tree.deselectAll();
deselectNode
Availability
Flash Player 9.
Description
Deslects the specified node in the tree if it is currently selected.
Arguments
deselectNode(node:TreeNode)
Returns
Nothing
Example
tree.deselectNode(tree.selectedNode);
expandAll
Availability
Flash Player 9.
Description
Opens all nodes in the tree.
Arguments
None
Returns
Nothing
Example
tree.expandAll();
findAttributeValue
Availability
Flash Player 9.
Description
Searches through tree from root node and returns first instance of node with the specified value for the specified attribute.
Arguments
findAttributeValue(attributeName:String, attributeValue:String)
Returns
TreeNode
Example
var node:TreeNode = tree.findAttributeValue("ID", "27");
tree.openToAndSelect(node);
getEnabled
Availability
Flash Player 9.
Description
Enables the selection of nodes and the scrolling of the tree.
Arguments
None
Returns
Boolean
Example
if (!tree.getEnabled()) return;
getMemento
Availability
Flash Player 9.
Description
Returns the current state of the tree, including its data and the open/close state of its nodes. This memento can then be passed back into the tree using the setMemento() method in order to set the tree back in its previous state. This is useful for providing undo/redo functionality for the tree.
Arguments
None
Returns
TreeMemento
Example
import com.flashloaded.ui.tree.TreeMemento;
var pMemento:TreeMemento = tree.getMemento();
history.push(pMemento);
getScrollPosition
Availability
Flash Player 9.
Description
Returns an Point instance containing the x and y position of the scrollbars in the scrollpane housing the tree.
Arguments
None
Returns
Point
Example
var pt:Point = tree.getScrollPosition();
tree.rootNode.addNode(node);
tree.setScrollPosition(pt);
getStyleProperty
Availability
Flash Player 9.
Description
Returns the value of a single style property of the tree.
Arguments
getStyleProperty(name:String)
Returns
Object
Example
import com.flashloaded.ui.tree.graphic.TreeStyles;
var color:uint = tree.getStyleProperty(TreeStyles.ROLLOVER_HIGHLIGHT);
initialize
Availability
Flash Player 9.
Description
Initializes the tree, causing it to render itself to the screen and load its data. By default, this is called the frame after the tree is instantiated to allow for dragging and dropping the component to the stage and allowing properties to be set in the timeline. However, if instantiating through code, this method can be called in order to have the rendering occur on the frame of instantiation. This is optional.
Arguments
None
Returns
Nothing
Example
var tree:AdvancedTree = new AdvancedTree();
tree.setSize(300, 400);
tree.file = "someFile.xml";
tree.initialize();
addChild(tree);
openNode
Availability
Flash Player 9.
Description
Opens the specified node in the tree if it is currently displayed.
Arguments
openNode(node:TreeNode)
Returns
Nothing
Example
tree.openNode(tree.rootNode);
openToAndSelect
Availability
Flash Player 9.
Description
Opens the tree to the specified node and selects it as well.
Arguments
openToAndSelect(node:TreeNode)
Returns
Nothing
Example
var node:TreeNode = tree.findAttributeValue("ID", "27");
tree.openToAndSelect(node);
openToNode
Availability
Flash Player 9.
Description
Opens the tree to reveal the specified node.
Arguments
openToNode(node:TreeNode)
Returns
Nothing
Example
var node:TreeNode = tree.findAttributeValue("ID", "27");
tree.openToNode(node);
populate
Availability
Flash Player 9.
Description
Removes the curent data from the tree and parses and displays the given XML.
Arguments
populate(xml:XML)
Returns
Nothing
Example
var treeXML:String = "<root><node1 /><node2 /></node3 /></root>";
tree.populate(new XML(treeXML));
refresh
Availability
Flash Player 9.
Description
Refreshes the display of the tree, necessary after a change has been made to its skin parameters or through a node method (like TreeNode.addNode).
Arguments
refresh()
Returns
Nothing
Example
tree.setSkin(TreeSkins.BRANCH_GRAPHIC, BranchSkin);
tree.refresh();
refreshNode
Availability
Flash Player 9.
Description
Refreshes the specified node in the tree if any changes have been made that do not immeidately update (mode graphic settings are only applied upon node creation). If the node's children should not be refreshed as well, pass false as a second argument.
Arguments
refreshNode(node:TreeNode, refreshChildren:Boolean=true)
Returns
Nothing
Example
var node:TreeNode = tree.selectedNode.parent;
node.styleFormat = selectedParentFormat;
tree.refreshNode(node, false);
refreshSelected
Availability
Flash Player 9.
Description
Refreshes the selected node in the tree if any changes have been made that do not immeidately update (mode graphic settings are only applied upon node creation). If the node's children should not be refreshed as well, pass false as an argument.
Arguments
refreshSelected(refreshChildren:Boolean=true)
Returns
Nothing
Example
var node:TreeNode = tree.selectedNode.parent;
node.iconGraphic = SelectedIcon;
tree.refreshSelected(false);
removeAll
Availability
Flash Player 9.
Description
Clears the tree of all nodes.
Arguments
None
Returns
Nothing
Example
tree.removeAll();
tree.refresh();
removeNode
Availability
Flash Player 9.
Description
Deletes the specified node from the tree.
Arguments
removeNode(node:TreeNode)
Returns
Nothing
Example
tree.removeNode(tree.selectedNode);
saveCurrentState
Availability
Flash Player 9.
Description
Sets as the tree's "memory" the current open/close state of the nodes in the tree. This value will be used to set the tree into the same state once fresh data has been loaded.
Arguments
None
Returns
Nothing
Example
tree.saveCurrentState();
scrollToNode
Availability
Flash Player 9.
Description
Sets the scroll position of the tree so that the specified node is visible at the top of the view (or as close to the top as permitted by the total contents of the tree).
Arguments
scrollToNode(node:TreeNode)
Returns
Boolean
Example
var node:TreeNode = tree.findAttributeValue("ID", "27");
tree.scrollToNode(node);
setEnabled
Availability
Flash Player 9.
Description
Enables the selection of nodes and the scrolling of the tree.
Arguments
setEnabled(enabled:Boolean)
Returns
Nothing
Example
tree.setEnabled(false);
setMemento
Availability
Flash Player 9.
Description
Returns the tree into a previously saved state, including its data and the open/close state of its nodes. The parameter passed in must be a TreeMemento instance as returned by the getMemento() method. This is useful for providing undo/redo functionality for the tree.
Arguments
setMemento(memento:TreeMemento)
Returns
Nothing
Example
import com.flashloaded.ui.tree.TreeMemento;
var pMemento:TreeMemento = history.pop() as TreeMemento;
tree.setMemento(pMemento);
setScrollPosition
Availability
Flash Player 9.
Description
Sets the x and y position of the scrollbars in the scrollpane housing the tree.
Arguments
setScrollPosition(position:Point)
Returns
Nothing
Example
var pt:Point = tree.getScrollPosition();
tree.rootNode.addNode(node);
tree.setScrollPosition(pt);
setSize
Availability
Flash Player 9.
Description
Resizes the tree to the specified dimensions.
Arguments
setSize(width:Number, height:Number)
Returns
Nothing
Example
tree.setSize(300, 400);
setSkin
Availability
Flash Player 9.
Description
Sets the class that will be used to draw a particular aspect of the tree, like a branch icon or the scrollwell.
Arguments
setSkin(name:String, skin:Class)
Returns
Nothing
Example
import com.flashloaded.ui.tree.graphic.TreeSkins;
tree.setSkin(TreeSkins.LEAF_GRAPHIC, MyLeafIconSkin);
setStyleProperty
Availability
Flash Player 9.
Description
Alters the style value of a single visual aspect in the tree the refreshes the view.
Arguments
setStyleProperty(name:String, value:Object)
Returns
Nothing
Example
import com.flashloaded.ui.tree.graphic.TreeStyles;
tree.setStyleProperty(TreeStyles.ROLLOVER_HIGHLIGHT, 0xFFFFFF);
toXML
Availability
Flash Player 9.
Description
Returns the tree's data as a string, formatted as XML. If true is passed as an argument, whitespace will be added to the XML for readability (tabs and linebreaks).
Arguments
toString(whitespace:Boolean)
Returns
String
Example
trace(tree.toXML(true));
var treeXML:XML = new XML(tree.toXML());
treeXML.send("http://mywebsite.com/sendXML.cfm", "_blank");