tags:

views:

22

answers:

3

I made a class Person.as with a few variables. Then I made an ArrayCollection 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?

A: 

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.

Maurycy Zarzycki
So if you use a class other than Object you have to implement a custom TreeDataDescriptor?
Wouwou
Maurycy Zarzycki
A: 

You can absolutely use an ArrayCollection with custom objects in it.

  1. Put all your elements in the ArrayCollection
  2. Bind the dataProvider property to the ArrayCollection
  3. Implement a labelFunction for the tree. This is enough for almost 80% of all cases I would say...

You can find some exmaple here:

If this should help, please vote/mark the answer. THX

Czar