Tuesday, June 16, 2009

Tree navigation with view stack

I've been prototyping navigation using Flex tree and view stack. You can do this easily with a ToggleButtonBar, LinkButtonBar by using the ViewStack as the data provider. I haven't seen many examples with a Flex Tree. It turns out that on an itemClick event you can switch views by assigning the selectedChild or selectedIndex of the view stack by doing the following - where the view attribute is an id of a container within the view stack.

public function navigateView(event:ListEvent):void {
var xmlList:XMLList = event.currentTarget.selectedItem.@view;
viewStack.selectedChild= this[xmlList.toString()];
}

No comments:

Post a Comment