1. XML Original format
<fx:xmllist id= "Menuxml" >
<Root>
<node sid= "029"
sname= "Six Huan Qu Toll station"
mydata= "GLOBAL" >
<node sid= "029710000"
sname= "inner ring Exit"
pid= "029"
mydata= "Exit" >
<node sid= "01002"
sname= "Outside First Lane"
Pid= "029710000"
sflag= "0"
mydata= "LANE"/>
</NODE>
</NODE>
</root >
</fx:XMLList>
2, select a node, this node through @mydata already know is that type
var xmlstring:string=menuxml;
if (xmlstring! = "<Root/>")
{
this.xml=new xml (xmlstring);
Loop the data of the last layer of nodes, which is the node data that should be selected, which can be set according to the hierarchy of the node for every
(Var treeitem:xml in Xml.children (). Children (). Children ( )
{
//If it is a parking unit, select and obtain the relevant information
if (treeItem. @MYDATA = = "LANE")
{
Tree_id.selecteditem=treeitem ;
Break;}}}
3. Expand All
if (!tree_id.isitemopen (XML (This.xml.NODE)))
{
This.tree_id.expandItem (XML (This.xml.NODE), true, true);
}
//Expand first-level node
// This.tree_id.expandItem (XML (this.xml. NODE. (@MYDATA = = "GLOBAL"), true, true);
Expand all nodes
for every (Var item:object in Tree_id.dataprovider)
{
tree_id.expandchildrenof (item, True);
}
4. Perform other methods after selecting the node
Gets the default selected node information
tree_id.calllater (function (): void
{
if (tree_id.selecteditem! = null)
{
Parknamestr=global_tree.selecteditem. @SNAME;
Parkidstr=global_tree.selecteditem. @SID;
Parkcostobj.findcostlist (PARKIDSTR); Execution method
}
});