Internationalizating images in Flex
I have a button in Flex that has mx:skin set to an image, but i want to set it so that when i change the language the image change as well. The code is something like the following:
<mx:Button id="btnMain">
<mx:skin>@Embed(source='main/resources/images/ABA_MAIN_IDLE.png')</mx:skin>
The way i handle i18n is by using a class called ConfigI18n that wraps the ResourceManager, and i just have to call it like i would with ResourceManager:
<mx:Label text="{ConfigI18n.getInstance().getString('someLabel')}"/>
I tried using the i18n within 开发者_如何学运维mx:skin but didn't work. Anyone also had the same problem or already did it?
Use IResourceManager.getClass().
In your resource file (messages.properties, say), embed the image:
idleImage=Embed("assets/images/idle.png")
Then in your code (using your example, but not sure of skin syntax):
<mx:Button id="btnMain">
<mx:skin>{resourceManager.getClass("messages", "idleImage")}</mx:skin>
</mx:Button>
精彩评论