I made a class Person.as with a few variables. Then I made an Arr开发者_开发百科ayCollection and did addItem(person1); addItem(person2); and binded this arraycollection to my tree with dataProvider="{oadp_tree}". Now it doesn't show up in my Tree.. While I made an example with dummy data in MXML and it does show up in my tree (MXML example uses .
Do I need to build my ArrayCollection up with var something:Object or can I use classes?
You can absolutely use an ArrayCollection with custom objects in it.
- Put all your elements in the ArrayCollection
- Bind the dataProvider property to the ArrayCollection
- Implement a labelFunction for the tree. This is enough for almost 80% of all cases I would say...
You can find some exmaple here:
- http://blog.flexexamples.com/2007/10/29/defining-a-custom-label-function-on-a-flex-tree-control/
If this should help, please vote/mark the answer. THX
Take a look at Tree's dataDescriptor:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Tree.html#dataDescriptor
And also labelField & labelFunction in the same object.
精彩评论