加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex tree 的使用 ArrayCollection为数据源

发布时间:2020-12-15 01:10:46 所属栏目:百科 来源:网络整理
导读:效果如图所示: ? ?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 treeChan

效果如图所示:

?

<?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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读