flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"
creationComplete="init()"
width="100%" height="100%"> import mx.controls.*;
import mx.events.*; import mx.collections.ArrayCollection; [Bindable] public var treeData:ArrayCollection; Array=new Array(); var one11:Object={label:"tree0",data:"11"}; ones.push(one11); var one22:Object={label:"tree1",data:"12"}; ones.push(one22); var one33:Object={label:"tree2",data:"13"}; ones.push(one33); treeData=new ArrayCollection(ones); //展开根节点
//myTree.expandItem(treeData.getItemAt(0), true);
//设置根节点选中
//myTree.selectedIndex = 0;
}
]]>
本文介绍了一种使用Adobe Flex框架进行树形控件初始化的方法。通过创建ArrayCollection实例并填充自定义对象来构建树形数据结构。示例代码展示了如何逐个添加节点并设置其属性。
14

被折叠的 条评论
为什么被折叠?



