2012年8月14日 星期二

【Flex】Using resource bundles

We know in flex,we will define different property file in different locale folder,usually we can get string by key as below:

   1: hello=Hello



   2: you=You






   1: hello=你好



   2: you=你




In actionscript3 we will use resourceManager.getString('locale',’hello')  set to the value.



and in mxml we will use text="@Resource(key='hello', bundle='locale')" set to value



If we embed the assets in flash(fla),and wanna retrieive the asset by symbol,we will define our property as below:





   1: betarea=Embed(source="./assets/assets.swf", symbol="asset.MySymbol")






   1: betarea=Embed(source="./assets/assets.swf", symbol="asset.MySymbolTW")




In actionscript3 we will use resourceManager.getObject('locale',’betarea') set to the value



and in mxml we will use source="@Resource(key='betarea', bundle='locale')" set to the value



If we define a class by actionscript3 or mxml for customized component and customized skin,we will define our property as below:







   1: entertable=ClassReference("com.leon456.skin.EnterTableSkin")






   1: entertable=ClassReference("com.leon456.skin.EnterTableSkinTW")




In actionscript3 we will use resourceManager.getObject('locale',’betarea') set to the value



and in mxml we will use skinClass="@Resource(key='entertable', bundle='baccaratmoduleui')" set to the value

沒有留言:

張貼留言