ActionScript 2.0 Components Language Reference |
|
|
|
| Tree component > Tree.refresh() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
treeInstance.refresh()
None.
Nothing.
Method; updates the tree.
The following example adds a node to a Tree instance called my_tr and creates listeners for a Refresh button and a Remove All button. Assuming the XML source for the data provider has changed, the user can click the Refresh button, and the code calls the refresh() method to update the tree contents.
You must first add an instance of the Tree component to the Stage and name it my_tr. Then add a button called refresh_button. Then add the following code to Frame 1 in the main timeline:
/**
Requires:
- Tree component on Stage (instance name: my_tr)
- Button component on Stage (instance name: refresh_button)
*/
var my_tr:mx.controls.Tree;
var refresh_button:mx.controls.Button;
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://yourXMLsourcehere");
function refreshListener(evt_obj:Object):Void {
my_tr.refresh();
}
refresh_button.addEventListener("click", refreshListener);
|
|
|
|