This content has been marked as final. Show 2 replies
Yes, I had some fun doing that one myself. The move from 1.5 to 2.0 was hell. I only hope the next upgrade is much, much smoother.
anyway, I digress... There is a caveat in my example, I used a xml file to be the data provider for the tree, so using an XMLCollection to select what I wanted, worked well. I'm not sure what your set up is. Anyway, the code:
<mx:Tree xmlns:mx=" http://www.adobe.com/2006/mxml"
<mx:XML id="authenticatedXML" source="pmportal_menu_authenticated.xml"/>
public function creationComplete():void
this.dataProvider = authenticatedXML;
var xmlListCollection:XMLListCollection = XMLListCollection(this.dataProvider);
var xmlListCollection2:XMLListCollection = new XMLListCollection(xmlListCollection.children());
var xmlListCollection3:XMLListCollection = new XMLListCollection(xmlListCollection2.source.child("FindCompany"));
this.selectedItem = xmlListCollection3.getItemAt(0);
Essentially, you have to transverse the xml to get the item. There is probably a better way to do this.....(as this is extremely clunky), hopefully someone can pipe up on how this should be done.
I advise using e4x XML as the dataProvider for the tree. It is by nature hierarchical and has very powerful search and navigation functionality.
There are many examples on CFLEX.net. Search for "tree".