我的工作在Flex 3中使用资源包,我在DataGrid中显示数据的多语言应用程序和定义的DataGridColumn HEADERTEXT这样
I'm working in a multi-language application using ResourceBundle in Flex 3. I'm displaying data in a DataGrid and defined DataGridColumn headerText like this
headerText="{localizedHeaderText('LABEL_USER_NAME')}
该函数返回本地化的标签,用户名,但是当我dynamcally选择其他语言evertying被刷新,但HEADERTEXT标签?
this function returns the localized label for the username, but when I dynamcally select another language evertying gets refreshed but the headerText labels?
有什么想法?
感谢
推荐答案
除非你做出localizedHeaderText方法绑定,绑定将永远不会重新评估,因为它不知道ResourceManager中的变动情况。
Unless you make the localizedHeaderText method bindable, the binding will never be re-evaluated since it does not know about the change event of the resourceManager.
假设你是在UIComponent子类中,你需要做到以下几点:
Assuming you are in a UIComponent subclass, you'll need to do the following:
覆盖resourcesChanged和调度自定义事件 补充[可绑定(事件=自定义事件)上面的方法样品code:
override protected function resourcesChanged():void {
super.resourcesChanged();
dispatchEvent(new Event("localeChange"));
}
和
[Bindable(event="localeChange")]
public function localizedHeaderText(key:String):String {
return resourceManager.getString('resources', key);
}
相关推荐
最新文章