一个在Tree空间中搜索字符串的例子,可以帮助理解如何遍历Tree的节点。
原文地址:http://labs.flexcoders.nl/?p=53
He Flexers,
************************************************************************************ It contained a bug, it stopped searching in a matching node. It now also is searching in it’s children. 30-03-2007- and another update!! ************************************************************************************
I got a question on my article about my endless (tree)-battle: “What do you mean by this request, “Find nodes by any containing property, but let’s start with a given id?”? Can you be more specific about what you are trying to do and what you want the Tree to do?”
Well the follwing sample will show what I mean. It’s showing how you can search in a (Array/ArrayCollection based) tree. It will return one object if the object is unique and if it’s not it will return an Array of possible results.
For example: The employee “M. Sibbald” exists three times in the given dataProvider, now if you search for it the method will return an array. If you search on id = 2, you will get one object back.
Now I think such a method should be one of the standard methods of a Tree. Ok ok, maybe not standard….but Adobe could provide some TreeUtils (hint!). |