使用flex控件tree当选中多节点中最里节点时将ta的内容(自定义类型String)写到另一个文本框中,请问怎么
1个回答
展开全部
<mx:Script>
<![CDATA[
public function treeChanged(event:Event):void
{
selectedNode=Tree(event.target).selectedItem as XML;
}
]]>
</mx:Script>
<mx:XMLListCollection id="datatree" >
<mx:source>
<mx:XMLList id="ww">
<node label="NO1">
<node label="NO11">
<node label="NO111" bool="true"/>
</node>
<node label="NO22" bool="true"/>
</node>
<node label="NO2">
<node label="NO11">
<node label="NO111" bool="true"/>
</node>
<node label="NO22">
<node label="NO222" bool="true"/>
</node>
</mx:XMLList>
</mx:source>
</mx:XMLListCollection>
<mx:HDividedBox width="100%" height="100%" color="0x323232">
<mx:Tree id="tree" width="50%" height="100%" labelField="@label"
showRoot="false" dataProvider="{datatree}" change="treeChanged(event)"/>
<mx:TextArea height="100%" width="50%" text="Selected Item: {selectedNode.@label}"/>
</mx:HDividedBox>
<![CDATA[
public function treeChanged(event:Event):void
{
selectedNode=Tree(event.target).selectedItem as XML;
}
]]>
</mx:Script>
<mx:XMLListCollection id="datatree" >
<mx:source>
<mx:XMLList id="ww">
<node label="NO1">
<node label="NO11">
<node label="NO111" bool="true"/>
</node>
<node label="NO22" bool="true"/>
</node>
<node label="NO2">
<node label="NO11">
<node label="NO111" bool="true"/>
</node>
<node label="NO22">
<node label="NO222" bool="true"/>
</node>
</mx:XMLList>
</mx:source>
</mx:XMLListCollection>
<mx:HDividedBox width="100%" height="100%" color="0x323232">
<mx:Tree id="tree" width="50%" height="100%" labelField="@label"
showRoot="false" dataProvider="{datatree}" change="treeChanged(event)"/>
<mx:TextArea height="100%" width="50%" text="Selected Item: {selectedNode.@label}"/>
</mx:HDividedBox>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询