I have a ToggleButtonBar with a DataProvider setup like this:
<mx:ToggleButtonBar itemClick='clickHandler(event);' selectedIndex='0'> <mx:dataProvider> <mx:String>{resourceManager.getString('dashboard','daily')}</mx:String> <mx:String>{resourceManager.getString('dashboard','monthly')}</mx:String> <mx:String>{resourceManager.getString('dashboard','quarterly')}</mx:String> <mx:String>{resourceManager.getString('dashboard','yearly')}</mx:String> </mx:dataProvider> </mx:ToggleButtonBar>
To switch locale to Chinese, I have a combobox with this handler:
resourceManager.localeChain = 'zh_CN';
My problem is that on locale change, while the labels for all the other controls on the screen dynamically reload for the new locale, the dataProvider values don’t refresh. I can manually reset them in code, but is there a cleaner solution?
I would abstract out the data for your data provider into a bindable variable, then just reset the data provider when you change locals.
Then you can just say
after you swap the locals and it should work.
Disclaimer, there may be some minor errors in my code, I obviously am not able to test it and I don’t have flex builder available right now to even check my syntax so I hope I didn’t make any spelling mistakes. But this should get you in the ballpark.