效果如图所示:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white" horizontalAlign="left">
<mx:Script>
<![CDATA[
public function treeChang(event:Event):void
{
txt.text = "你选择的是:"+tree.selectedItem.label;
}
]]>
</mx:Script>
<mx:Array id="arr" >
<mx:Object label="基本设置">
<mx:children>
<mx:Array>
<mx:Object label="one" />
<mx:Object label="two"/>
<mx:Object label="three"/>
<mx:Object label="four"/>
<mx:Object label="five"/>
</mx:Array>
</mx:children>
</mx:Object>
<mx:Object label="玩家统计">
<mx:children>
<mx:Array>
<mx:Object label="one"/>
<mx:Object label="two"/>
</mx:Array>
</mx:children>
</mx:Object>
<mx:Object label="查询管理">
<mx:children>
<mx:Array>
<mx:Object label="one"/>
<mx:Object label="tree" />
</mx:Array>
</mx:children>
</mx:Object>
<mx:Object label="管理员管理">
<mx:children>
<mx:Array>
<mx:Object label="one" />
<mx:Object label="two" />
<mx:Object label="three" />
</mx:Array>
</mx:children>
</mx:Object>
<mx:Object label="版本管理">
<mx:children>
<mx:Array>
<mx:Object label="one" />
<mx:Object label="two" />
</mx:Array>
</mx:children>
</mx:Object>
</mx:Array>
<mx:HDividedBox width="100%" height="100%">
<mx:Tree id="tree" height="100%" dataProvider="{arr}" fontSize="15"
dragEnabled="true" dropEnabled="true" width="324" labelField="label" change="treeChang(event)"/>
<mx:TextArea id="txt" width="60%" height="100%" fontSize="13"/>
</mx:HDividedBox>
</mx:Application>