2010-01-13 84 views
0

我在Flex中有一個按鈕,它將mx:skin設置爲圖像,但我想設置它以便當我更改圖像時語言也會更改。該代碼是類似以下內容:Flex中的國際化圖像

<mx:Button id="btnMain"> 
    <mx:skin>@Embed(source='main/resources/images/ABA_MAIN_IDLE.png')</mx:skin> 

我處理國際化的方法是使用一類叫做ConfigI18n一個包裝ResourceManager的,我只需要調用它,我會的ResourceManager:

<mx:Label text="{ConfigI18n.getInstance().getString('someLabel')}"/> 

我嘗試使用mx:skin中的i18n,但沒有工作。任何人也有同樣的問題或已經做到了?

回答

2

使用IResourceManager.getClass()

在資源文件(messages.properties,說),嵌入圖像:

idleImage=Embed("assets/images/idle.png") 
在你的代碼

然後(使用你的榜樣,但不知道皮膚的語法):

<mx:Button id="btnMain"> 
    <mx:skin>{resourceManager.getClass("messages", "idleImage")}</mx:skin> 
</mx:Button>