mxml:

<?xml version="1.0" encoding="utf-8"?>

<!--功能描述:将数组作为dataProvider-->

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script>
<![CDATA[
protected function tree_labelFunction(item:Object):String
{
var num:String = "";
if (tree.dataDescriptor.hasChildren(item)) {
num = " (" + item.children.length + ")";
}
return item.label + num;
}
]]>
</fx:Script> <fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:Array id="data">
<fx:Object label="周星驰">
<fx:children>
<fx:Object label="1988">
<fx:children>
<fx:Object label="《霹雳先锋》香港票房8916612" />
<fx:Object label="《捕风汉子》香港票房3149395" />
<fx:Object label="《最佳女婿》香港票房5807710" />
</fx:children>
</fx:Object>
<fx:Object label="1989">
<fx:children>
<fx:Object label="《龙在天涯》香港票房6809853 " />
<fx:Object label="《义胆群英》香港票房7913329" />
<fx:Object label="《流氓差婆》香港票房5624622 " />
<fx:Object label="《风雨同路》香港票房9335299 " /> </fx:children>
</fx:Object>
</fx:children>
</fx:Object>
<fx:Object label="李连杰">
<fx:children>
<fx:Object label="1992">
<fx:children>
<fx:Object label="笑傲江湖之东方不败(1992)" />
<fx:Object label="黄飞鸿之二男儿当自强(1992)" />
<fx:Object label="黄飞鸿之三狮王争霸(1992)" />
</fx:children>
</fx:Object>
<fx:Object label="1993">
<fx:children>
<fx:Object label="方世玉Ⅱ万夫莫敌(1993) " />
<fx:Object label="倚天屠龙记之魔教教主(1993)" />
<fx:Object label="黄飞鸿之铁鸡斗蜈蚣(1993) " />
<fx:Object label="太极张三丰(1993) " /> </fx:children>
</fx:Object>
<fx:Object label="1993">
<fx:children>
<fx:Object label="新少林五祖(1994) " />
<fx:Object label="精武英雄(1994)" />
<fx:Object label="中南海保镖(1994) " />
<fx:Object label="给爸爸的信(1995) " />
</fx:children>
</fx:Object>
</fx:children>
</fx:Object>
</fx:Array>
</fx:Declarations> <mx:Tree id="tree" dataProvider="{data}" labelField="label" width="320" labelFunction="tree_labelFunction"/>
</s:Application>

[Flex] 组件Tree系列 —— 将数组作为dataProvider的更多相关文章

  1. [Flex] 组件Tree系列 —— 打开和关闭节点

    mxm: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:打开和关闭节点--> < ...

  2. [Flex] 组件Tree系列 —— 运用variableRowHeight和wordWrap设置可变行高

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用variableRowHeig ...

  3. [Flex] 组件Tree系列 —— 作为PopUpButton的弹出菜单

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:Tree作为PopUpButton ...

  4. [Flex] 组件Tree系列 —— 支持元素的拖放排序

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持元素拖放排序--> &l ...

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

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述: 利用firstVisibleIt ...

  6. [Flex] 组件Tree系列 —— 运用LabelFunction hasChildren getChildren设置Tree包含节点个数

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用LabelFunction h ...

  7. [Flex] 组件Tree系列 —— 运用openItems获取打开节点

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用openItems获取打开节点 ...

  8. [Flex] 组件Tree系列 —— 支持CheckBox组件

    主程序mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持CheckBox--&g ...

  9. [Flex] 组件Tree系列 —— 阻止用户点击选中Tree中分支节点

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:阻止用户点击选中Tree中分支节点 ...

随机推荐

  1. python 文件的读取&更新

    [python 文件的读取&更新] 任务抽象: 读取一个文件, 更新内容后, 重新写入文件. 实际应用: 磁盘上的一个配置文件, 读入内存后为一个dict, 对dict更新后重新写入磁盘. d ...

  2. Java-随机数工具类

    import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import org.apache.commons.la ...

  3. 785. Is Graph Bipartite?从两个集合中取点构图

    [抄题]: Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is  ...

  4. 380. Insert Delete GetRandom O(1) 设计数据结构:在1的时间内插入、删除、产生随机数

    [抄题]: Design a data structure that supports all following operations in average O(1) time. insert(va ...

  5. adf笔记

    1>jsf页面js调试,手动添加debugger调试 方案:在页面中添加debugger,然后打开“开发者工具”(必须打开),直接运行页面自动跳转到debugger处. 2>jdevelo ...

  6. appium_server_v1.4.16版本不适配android7.0系统,运行报错“Attempt to re-install io.appium.settings without first uninstalling”

    要解决的问题:appium在androidV7.0系统上运行时报错 Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.a ...

  7. p2944 [USACO09MAR]地震损失2Earthquake Damage 2

    传送门 分析 我们让s到1,关键点到t分别连流量为inf的边 于是我们可以考虑跑s到t的最小割 于是我们将所有点拆为两个点,关键点和1的两个点之间连inf,其余点连1 将原图的边也连上,流量为inf ...

  8. Spring Boot☞ 使用Thymeleaf模板引擎渲染web视图

    静态资源访问 在我们开发Web应用的时候,需要引用大量的js.css.图片等静态资源. 默认配置 Spring Boot默认提供静态资源目录位置需置于classpath下,目录名需符合如下规则: /s ...

  9. python学习之内部执行流程,内部执行流程,编码(一)

    python的执行流程: 加载内存--->词法分析--->语法分析--->编译--->转换字节码---->转换成机器码---->供给CPU调度 python的编码: ...

  10. transition与animation的区别

    transition需要事件触发,animation可以直接自动触发,而且功能上更为强大,包括可以设置不同时间段的动画规则,还有状态的控制,事件等等.