+展开-ActionScript
var largeObject:Object = [{ id:"1", name:"Misc", type:"parent", parentTask:"0"},
{id:"2", name:"Clean the kitchen", type:"parent",
parentTask:"0"},
{id:"3", name:"Pay the bills", type:"parent", parentTask:"0"},
{id:"4", name:"Paint the shed", type:"parent", parentTask:"1"},
{id:"5", name:"Get ready for party", type:"parent",
parentTask:"1"},
{id:"6", name:"Do the dishes", type:"child", parentTask:"2"},
{id:"7", name:"Take out trash", type:"child", parentTask:"2"},
{id:"8", name:"Registration", type:"child", parentTask:"3"},
{id:"9", name:"Fix the car", type:"parent", parentTask:"0"},
{id:"10", name:"New tires", type:"child", parentTask:"9"},
{id:"11", name:"Get new paint", type:"child", parentTask:"4"},
{id:"12", name:"Buy Drinks", type:"child", parentTask:"5"},
{id:"13", name:"finish invitations", type:"child",
parentTask:"5"}];
/* create a new class that implements the IHierarchicalData
interface */
var dataObj:ObjectHierarchicalData =
new ObjectHierarchicalData(largeObject);
/* pass that class to the HierarchicalCollectionView class*/
var hCollView:HierarchicalCollectionView = new
HierarchicalCollectionView(dataObj);
hCollView.openNode(largeObject[2]);
var ac:ArrayCollection =
hCollView.getChildren( hCollView.source.getData({id:"3"}));
hCollView.closeNode(hCollView.source.getData({name:"Pay the bills"})