开发者

Maintain combobox selected item across TabNavigator Tabs

开发者 https://www.devze.com 2022-12-25 07:03 出处:网络
I\'ve just recently 开发者_如何学Cstarted out using Flash Builder and have a question surrounding states. In fact I\'m not entirely sure it is related to states but read on and I hope it will become c

I've just recently 开发者_如何学Cstarted out using Flash Builder and have a question surrounding states. In fact I'm not entirely sure it is related to states but read on and I hope it will become clearer. I currently have a custom component that contains 3 comboboxes. This resides in a TabNavigator component. The TabNavigator consits of 5 pages (Tabs). The custom container holding the comboboxes should display the same selected data across all Tabs. ie. If I am in Tab1 and select an item from one of the comboboxes then click on Tab2 I need to mirror the combobox's selection in Tab2. Can anyone offer me suggestions on how to best tackle this? Di I need to set a global variable?


Rather than using a TabNavigator and duplicates of your custom control, you should break the TabNavigator into a TabBar and a ViewStack and use a single instance of the custom control.

Something like this should do it:

<mx:TabBar dataProvider="{myViewStack}" />
<mx:VBox>
    <local:MyComponent />
    <mx:ViewStack id="myViewStack">
        <mx:VBox label="Tab 1" />
        <mx:VBox label="Tab 2" />
    </mx:ViewStack>
</mx:VBox>
0

精彩评论

暂无评论...
验证码 换一张
取 消