【发布时间】:2014-03-06 09:51:37
【问题描述】:
那天我试图找到一种将变量绑定到本地化资源的方法,但我真的没有任何结果。
情况如下: 我有一个类 ComponentTypes.as,它包含一些字符串类型的公共变量。 我希望将这些变量绑定到已翻译的资源:
package Model
{
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
public class ComponentTypes
{
private static var resourceManagerInstance:IResourceManager = ResourceManager.getInstance();
//Areas and Volumes
[Bindable]
public static var HEATED_AREA:String = resourceManagerInstance.getString('app','phpx.componenttypes.heatedareas');
[Bindable]
public static var HEATED_VOLUME:String = resourceManagerInstance.getString('app','phpx.componenttypes.heatedvolumes');
}
}
但是,当区域设置更改时,这些变量不会更新。这很清楚,因为它们目前不受约束。
所以我的问题是:有没有办法可以将这些变量绑定到 ResourceManager 类,以便在更改语言环境时更新它们?
【问题讨论】:
-
看看IResourceManager.update();可能是您正在寻找的。span>
-
不,它不起作用。文档说:“这会导致绑定表达式重新评估......”,但是我没有绑定表达式。这正是我的问题 - 如何将变量绑定到资源管理器。
标签: actionscript-3 apache-flex localization air desktop-application