Hi,
I define localization resource on image like:
Enlish:
menu.admin.down=
Embed(''assets/en/administrator_down.gif'')
Koren:
menu.admin.down=
Embed(''assets/ko/administrator_down.gif'')
My code like:
%26lt;mx:Image source=''@Resource(key='menu.server.down', bundle='lang')'' /%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('lang', 'menu.lang')}'' /%26gt;
Label?is to display correct Koren, but image is still stay at Enlish, maay I know whaat problem on it?
Thanks,
Localize an application for imageHi,
do you write correct?
menu.admin.down=
Embed(''assets/en/administrator_down.gif'')
%26lt;mx:Image source=''@Resource(key='menu.server.down', bundle='lang')'' /%26gt;
Localize an application for imageI can make sure it does not work for image. it seem to need to trigger to get it work. I have two code show this issue.
First code, when language switch from English to Koren, label is changed, but image did not change to koren image.
Second code, I add a state to create image. when language switch from English to Koren, then click button to switch to ''create image'' state, it will display correct koren image.
Some one can figure out what happen, why it does not work for first situation?
(First code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:Application%26gt;
(second code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Button label=''switch'' click=''currentState = 'createImage';'' /%26gt;
?%26lt;mx:Canvas width=''100%'' height=''100%'' id=''home''%26gt;
?%26lt;/mx:Canvas%26gt;
?%26lt;mx:states%26gt;
?%26lt;mx:State name=''createImage''%26gt;
%26lt;mx:AddChild relativeTo=''{home}''%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:AddChild%26gt;
?%26lt;/mx:State%26gt;
?%26lt;/mx:states%26gt;?
%26lt;/mx:Application%26gt;
I can make sure it does not work for image. it seem to need to trigger to get it work. I have two code show this issue.
First code, when language switch from English to Koren, label is changed, but image did not change to koren image.
Second code, I add a state to create image. when language switch from English to Koren, then click button to switch to ''create image'' state, then it display correct koren image.
Some one can figure out what happen, why it does not work for first situation?
(First code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:Application%26gt;
(second code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Button label=''switch'' click=''currentState = 'createImage';'' /%26gt;
?%26lt;mx:Canvas width=''100%'' height=''100%'' id=''home''%26gt;
?%26lt;/mx:Canvas%26gt;
?%26lt;mx:states%26gt;
?%26lt;mx:State name=''createImage''%26gt;
%26lt;mx:AddChild relativeTo=''{home}''%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:AddChild%26gt;
?%26lt;/mx:State%26gt;
?%26lt;/mx:states%26gt;?
%26lt;/mx:Application%26gt;
I can make sure it does not work for image. it seem to need to trigger to get it work. I have two code show this issue.
First code, when language switch from English to Koren, label is changed, but image did not change.
Second code, I add a state to create image. when language switch from English to Koren, then click button to switch to ''create image'' state, then it display correct koren image.
Some one can figure out what happen, why it does not work for first situation?
(First code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:Application%26gt;
(second code)
%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;
%26lt;mx:Application xmlns:mx=''http://www.adobe.com/2006/mxml'' layout=''vertical''%26gt;
%26lt;mx:Metadata%26gt;
?[ResourceBundle(''form'')]
%26lt;/mx:Metadata%26gt;
%26lt;mx:XMLList id=''localeDD''%26gt;
?%26lt;locale key=''1'' value=''English'' /%26gt;
?%26lt;locale key=''2'' value=''Koren'' /%26gt;
%26lt;/mx:XMLList%26gt;
%26lt;mx:Script%26gt;
?%26lt;![CDATA[
?import mx.resources.ResourceBundle;
?private static var rb:ResourceBundle;
private function setLocale():void {
?var selectedLocale:String = localeDropDown.selectedItem.@key;
?if (''1'' == selectedLocale) {
resourceManager.localeChain = [''en_US''];
?} else if (''2'' == selectedLocale) {
resourceManager.localeChain = [''ko_KR''];
?}?
}
?]]%26gt;
%26lt;/mx:Script%26gt;
%26lt;mx:ComboBox id=''localeDropDown'' x=''329'' y=''165'' editable=''true'' enabled=''true''
?dataProvider=''{localeDD}'' labelField=''@value'' change=''setLocale()''/%26gt;
%26lt;mx:Label x=''225'' y=''167'' text=''Select Locale'' color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
%26lt;mx:Label x=''238'' y=''196'' text=''{resourceManager.getString('form', 'firstname')}''
?color=''#FFFFFF'' fontWeight=''bold'' fontSize=''13''/%26gt;
?%26lt;mx:Button label=''switch'' click=''currentState = 'createImage';'' /%26gt;
?%26lt;mx:Canvas width=''100%'' height=''100%'' id=''home''%26gt;
?%26lt;/mx:Canvas%26gt;
?%26lt;mx:states%26gt;
?%26lt;mx:State name=''createImage''%26gt;
%26lt;mx:AddChild relativeTo=''{home}''%26gt;
?%26lt;mx:Image source=''@Resource(key='menu', bundle='form')'' /%26gt;
%26lt;/mx:AddChild%26gt;
?%26lt;/mx:State%26gt;
?%26lt;/mx:states%26gt;?
%26lt;/mx:Application%26gt;
I try to attached files, someone can help me?