ActionScript 2.0 Components Language Reference |
|
|
|
| Tree component > Tree.removeAll() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
treeInstance.removeAll()
None.
Nothing.
Method; removes all nodes and refreshes the tree.
The following example adds a node to a Tree instance called my_tr and creates a listener for a Remove All button. When the user clicks the Remove All button, the code calls the removeAll() method to remove all nodes from the tree.
You first add an instance of the Tree component to the Stage and name it my_tr and add a button called removeAll_button; then add the following code to Frame 1.
/**
Requires:
- Tree component on Stage (instance name: my_tr)
- Button component on Stage (instance name: refresh_button)
- Button component on Stage (instance name: removeAll_button)
*/
var my_tr:mx.controls.Tree;
var removeAll_button:mx.controls.Button;
my_tr.setSize(200, 100);
var trDP_xml:XML = new XML();
trDP_xml.ignoreWhite = true;
trDP_xml.onLoad = function() {
my_tr.dataProvider = this.firstChild;
};
trDP_xml.load("http://www.flash-mx.com/mm/xml/tree.xml");
function removeAllListener(evt_obj:Object):Void {
my_tr.removeAll();
}
removeAll_button.addEventListener("click", removeAllListener);
|
|
|
|