标签:
mxml:
1 <?xml version="1.0" encoding="utf-8"?> 2 <!--功能描述:运用openItems获取打开节点--> 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.TreeEvent; 9 import mx.utils.ObjectUtil; 10 11 protected function tree_itemHandler(event:TreeEvent):void 12 { 13 openItemArr = tree.openItems as Array; 14 } 15 16 ]]> 17 </fx:Script> 18 <fx:Declarations> 19 <!-- 将非可视元素(例如服务、值对象)放在此处 --> 20 <fx:Array id="openItemArr" /> 21 <fx:XML id="xml" xmlns=""> 22 <data> 23 <item label="周星驰"> 24 <item label="1988"> 25 <item label="《霹雳先锋》香港票房8916612 " /> 26 <item label="《捕风汉子》香港票房3149395 " /> 27 <item label="《最佳女婿》香港票房5807710 " /> 28 </item> 29 <item label="1989"> 30 <item label="《龙在天涯》香港票房6809853 " /> 31 <item label="《义胆群英》香港票房7913329 " /> 32 <item label="《流氓差婆》香港票房5624622 " /> 33 <item label="《风雨同路》香港票房9335299 " /> 34 </item> 35 <item label="1990 "> 36 <item label="《望夫成龙》香港票房13703364 " /> 37 <item label="《咖喱辣椒》香港票房15777856 " /> 38 <item label="《小偷阿星》香港票房7968106 " /> 39 <item label="《师兄撞鬼》香港票房12128944 " /> 40 <item label="《赌圣》香港票房41326156 " /> 41 <item label="《无敌幸运星》香港票房18799869" /> 42 <item label="《江湖最后一个大佬》香港票房5495811 " /> 43 </item> 44 </item> 45 <item label="李连杰"> 46 <item label="1992"> 47 <item label="笑傲江湖之东方不败(1992)" /> 48 <item label="黄飞鸿之二男儿当自强(1992)" /> 49 <item label="黄飞鸿之三狮王争霸(1992)" /> 50 </item> 51 <item label="1993"> 52 <item label="方世玉Ⅱ万夫莫敌(1993)" /> 53 <item label="倚天屠龙记之魔教教主(1993)" /> 54 <item label="黄飞鸿之铁鸡斗蜈蚣(1993)" /> 55 <item label="太极张三丰(1993)" /> 56 </item> 57 <item label="1994"> 58 <item label="新少林五祖(1994)" /> 59 <item label="精武英雄(1994)" /> 60 <item label="中南海保镖(1994) " /> 61 <item label="给爸爸的信(1995" /> 62 </item> 63 <item label="1995"> 64 <item label="鼠胆龙威(1995)" /> 65 <item label="给爸爸的信(1995" /> 66 </item> 67 </item> 68 </data> 69 </fx:XML> 70 <s:XMLListCollection id="data" source="{xml..item}" /> 71 </fx:Declarations> 72 <s:controlBarContent> 73 <s:Label text="Tree openItems length: {openItemArr.length}" /> 74 </s:controlBarContent> 75 <mx:HDividedBox width="100%"> 76 <mx:Tree id="tree" dataProvider="{xml}" labelField="@label" showRoot="false" rowCount="8" width="50%" itemOpen="tree_itemHandler(event)" itemClose="tree_itemHandler(event)" /> 77 <s:List id="list" dataProvider="{data}" labelField="@label" width="50%" height="100%" /> 78 <s:TextArea id="textArea" editable="false" text="{ObjectUtil.toString(openItemArr)}" width="50%" height="100%" /> 79 </mx:HDividedBox> 80 </s:Application>
[Flex] 组件Tree系列 —— 运用openItems获取打开节点
标签:
原文地址:http://www.cnblogs.com/frost-yen/p/4308815.html