I'd like to have an mx:Tree that acts as a navigation menu; where
clicking an item in the Tree switches a viewStack to the corresponding
page.
I have an xml file with nodes that look like this:
<section name="Folder 1" sectName="Folder 1" catID="1">
<subsection name="Item 1" subName="itemOne" />
<subsection name="Item 2" subName="itemTwo" />
</section>
When rendered in a tree it creates a folder called Folder 1 with two
sub-items called Item 1 and Item 2, respectively.
I have a function that's triggered onChange for the tree that looks
like this:
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem;
var myDestination:String = [EMAIL PROTECTED];
trace ([EMAIL PROTECTED]);
}
That runs fine. Clicking on a item in the Tree traces "itemOne" or
"itemTwo" in the console.
Now... I then have a viewStack with children named "itemOne" and
"itemTwo."
And I want to have the tree change read the newly selected item in the
tree and go to the corresponding viewStack child.
So I added this to the function:
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem;
var myDestination:String = [EMAIL PROTECTED];
myViewstack.selectedChild = [EMAIL PROTECTED];
}
unfortunately, this doesn't work. does anyone see how to do this better?