This content has been marked as final. Show 5 replies
Here's some wierd code that works:
sorry, after reading my post i could have been more clear.
i'm trying to capture an event from a navigation component within a tab of the tabnavigator.
i.e. a click of the "Next" would tabNav.selectedIndex++ or "Prev" would tabNav.selectedIndex--
i would also obviously need to check for tab count to avoid runtime errors, but i'm just trying to capture the component event which consists of a prev and next button.
So your problem is basically trying to figure out which parent is the tab navigator? This is a common problem in flex. The easiest way to accomplish what you're trying to do is use the model locator pattern.
Basically what you do is create a bindable static var on a class called "ModelLocator" or something similar, then you bind the TavNavigator's selectedIndex property to that bindable var:
Then whenever you want the tabnavigator to switch tabs, simply update the static var on your modellocator.
Okay, so in the code that I provided, instead of Labels have buttons, Next and Previous, and have a click listener that does tab.selectedIndex++ or tab.selectedIndex-- and also checks if the new index is 0 ("Previous" button enabled property to false) or if the new index is tab.numChildren-1
("Next" button enabled property to false).
My Flex Cookbook entry might help as well:
Building a wizard using a simplified MVC architecture
Thanks for the input guys. My issue was the component i setup. it consisted of the two nav buttons in question and i didn't have them dispatching the right way in the component itself.