AS3 / Flex 4, hide nodes in Tree, while keeping children visible
I'm displaying data from an XML file (simplified below) with an mx:Tree class in Flex. I don't want the array node to show up, as it distracts from what's important. But I need to retain it for later when I copy the tree. Can I hide all array nodes while keeping children of array nodes visible? Thanks.
<property name="responses">
&l开发者_JAVA技巧t;array>
<object type="Type 1">
<property name="text" value="some text"/>
<property name="next" value="3"/>
</object>
<object type="Type 2">
<property name="text" value="some text"/>
<property name="next" value="3"/>
</object>
</array>
</property>
Create a custom Tree data descriptor.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/treeClasses/ITreeDataDescriptor.html
Set showRoot on your tree to false. That should take care of it.
I extended DefaultDataDescriptor and everything worked.
精彩评论