Hello,

I have a treeView based on a XML-list.

<mx:XMLList id="xmlData">

<folder label="Toplevel">
      <folder label="2ndLevel_folder1"/>
      <folder label="2ndLevel_folder2"/>

      <folder label="2ndLevel_folder3">
           <file label="File1"/>
           <file label="File2"/>
           <file label="File3"/>
      </folder>

      <folder label="2ndLevel_folder4">
           <file label="File4"/>
           <file label="File5"/>
           <file label="File6"/>
      </folder>

</folder>



I have a piece of code which shows me a treeview. In here I want to
extend each label with the number of items which are under each node. I
already can do that, but it only gives me the number of children
directly under the node (in this example no matter if the item is a
folder or a label).

private function tvwNrOfFiles(item:XML):String {
      var label:String = it...@label;



      if (treeData.dataDescriptor.hasChildren(item)) {
           label += " (" +
treeData.dataDescriptor.getChildren(item).length + ")";
      }

      return label;
}



What I want is to see how many items of the type files  are below each
node, no matter the number of subfolders which are in between.

Based on the example I need following result :

- TopLvevel (6)
      - 2nd Level_Folder1 (0)
      - 2nd Level_Folder2 (0)
      - 2nd Level_Folder3 (3)
      - 2nd Level_Folder4 (3)

Hope this is a bit clear.

Thanks in advance

Reply via email to