• [Flex] 组件Tree系列 —— 利用firstVisibleItem属性,设置或取得第一个显示节点


    mxml:

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <!--功能描述: 利用firstVisibleItem属性,设置或取得第一个显示节点 -->
     3 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
     4                xmlns:s="library://ns.adobe.com/flex/spark" 
     5                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
     6     <fx:Script>
     7         <![CDATA[
     8             import mx.events.FlexEvent;
     9             
    10             import spark.events.IndexChangeEvent;
    11             
    12             protected function comboBox_changeHandler(event:IndexChangeEvent):void
    13             {
    14                 tree.firstVisibleItem = comboBox.selectedItem;
    15             }
    16             
    17             protected function tree_creationCompleteHandler(event:FlexEvent):void
    18             {
    19                 tree.expandChildrenOf(data, true);
    20             }
    21             
    22         ]]>
    23     </fx:Script>
    24     <fx:Declarations>
    25         <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    26         
    27             <fx:XML id="data" xmlns="">
    28                 <data>
    29                     <item label="周星驰">
    30                         <item label="1988">
    31                             <item label="《霹雳先锋》香港票房8916612 " />
    32                             <item label="《捕风汉子》香港票房3149395 " />
    33                             <item label="《最佳女婿》香港票房5807710 " />
    34                         </item>
    35                         <item label="1989">
    36                             <item label="《龙在天涯》香港票房6809853 " />
    37                             <item label="《义胆群英》香港票房7913329 " />
    38                             <item label="《流氓差婆》香港票房5624622 " />
    39                             <item label="《风雨同路》香港票房9335299 " />
    40                         </item>
    41                         <item label="1990 ">
    42                             <item label="《望夫成龙》香港票房13703364 " />
    43                             <item label="《咖喱辣椒》香港票房15777856 " />
    44                             <item label="《小偷阿星》香港票房7968106 " />
    45                             <item label="《师兄撞鬼》香港票房12128944 " />
    46                             <item label="《赌圣》香港票房41326156 " />
    47                             <item label="《无敌幸运星》香港票房18799869" />
    48                             <item label="《江湖最后一个大佬》香港票房5495811 " />
    49                         </item>
    50                     </item>
    51                     <item label="李连杰">
    52                         <item label="1992">
    53                             <item label="笑傲江湖之东方不败(1992)" />
    54                             <item label="黄飞鸿之二男儿当自强(1992)" />
    55                             <item label="黄飞鸿之三狮王争霸(1992)" />
    56                         </item>
    57                         <item label="1993">
    58                             <item label="方世玉Ⅱ万夫莫敌(1993)" />
    59                             <item label="倚天屠龙记之魔教教主(1993)" />
    60                             <item label="黄飞鸿之铁鸡斗蜈蚣(1993)" />
    61                             <item label="太极张三丰(1993)" />
    62                         </item>
    63                         <item label="1994">
    64                             <item label="新少林五祖(1994)" />
    65                             <item label="精武英雄(1994)" />
    66                             <item label="中南海保镖(1994) " />
    67                             <item label="给爸爸的信(1995" />
    68                         </item>
    69                         <item label="1995">
    70                             <item label="鼠胆龙威(1995)" />
    71                             <item label="给爸爸的信(1995" />
    72                         </item>
    73                     </item>
    74                 </data>
    75             </fx:XML>
    76         
    77         <s:XMLListCollection id="xml" source="{data..item}" >
    78             
    79         </s:XMLListCollection>
    80     </fx:Declarations>
    81     
    82     <s:controlBarContent>
    83         <s:Form styleName="plain">
    84             <s:FormItem label="firstVisibleItem">
    85                 <s:ComboBox id="comboBox" dataProvider="{xml}" labelField="@label" width="300" change="comboBox_changeHandler(event)" />
    86             </s:FormItem>
    87         </s:Form>
    88     </s:controlBarContent>
    89     <mx:Tree id="tree" dataProvider="{data}" labelField="@label" showRoot="false" width="50%" alternatingItemColors="[0xeeeeee,0xffffff]" rowCount="6" creationComplete="tree_creationCompleteHandler(event)">
    90         
    91     </mx:Tree>
    92 </s:Application>
  • 相关阅读:
    Domain Logic approaches
    Comparing Spring AOP and AspectJ
    CDI Features
    Java Design Patterns
    第二阶段:代码片段
    第一阶段:学生在线系统需求分析报告
    load data语句实验报告
    Sping AOP Capabilities and Goals
    Java Design Patterns
    CDI Features
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4308837.html
Copyright © 2020-2023  润新知