开发者

Maintain combobox selected item across TabNavigator Tabs

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜