title: Changing locales at run time with the ResourceManager - with test case and screenshot
body: <p>I'm trying to add more locales to a Flex mobile app and have prepared a simple test case to demonstrate the problem I have currently:</p>
  
  <p><strong>Screenshot:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/wxxmf.png" alt="screenshot"></p>
  
  <p><strong>TestLang.mxml</strong> (just add to a blank project in Flash Builder 4.7):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                 xmlns:s="library://ns.adobe.com/flex/spark" 
                 initialize="init()"&gt;
  
      &lt;fx:Metadata&gt;
          [ResourceBundle("resources")]
      &lt;/fx:Metadata&gt; 
  
      &lt;fx:Script&gt;
          &lt;![CDATA[
              import mx.collections.ArrayCollection;
              import spark.events.IndexChangeEvent;
  
              [Bindable]
              private var _locales:ArrayCollection = new ArrayCollection();
  
              [Bindable]
              private var _numbers:ArrayCollection = new ArrayCollection();
  
              private function init():void {
                  resourceManager.localeChain = [ 'de_DE' ];
  
                  _locales.addItem({ locale: 'en_US', label: 'English' });
                  _locales.addItem({ locale: 'ru_RU', label: 'Русский' });
                  _locales.addItem({ locale: 'de_DE', label: 'Deutsch' });
  
                  localize();
              }
  
              private function localize():void {
                  _numbers.removeAll();
                  _numbers.addItem({ label: resourceManager.getString('resources', 'menu.one') });
                  _numbers.addItem({ label: resourceManager.getString('resources', 'menu.two') });
                  _numbers.addItem({ label: resourceManager.getString('resources', 'menu.three') });
                  _numbers.addItem({ label: resourceManager.getString('resources', 'menu.four') });
                  _numbers.addItem({ label: resourceManager.getString('resources', 'menu.five') });
              }
  
              protected function changeLocale(event:IndexChangeEvent):void {
                  var list:List = event.target as List;
                  var item:Object = list.selectedItem;
                  resourceManager.localeChain = [ item.str ]; // XXX
                  localize();
              }
  
          ]]&gt;
      &lt;/fx:Script&gt; 
  
      &lt;s:layout&gt;
          &lt;s:VerticalLayout /&gt;
      &lt;/s:layout&gt;
  
      &lt;s:List 
          width="100%" 
          height="50%"
          change="changeLocale(event)"
          dataProvider="{_locales}"&gt;
          &lt;s:itemRenderer&gt;
              &lt;fx:Component&gt;
                  &lt;s:IconItemRenderer labelField="label" /&gt;
              &lt;/fx:Component&gt;
          &lt;/s:itemRenderer&gt;
      &lt;/s:List&gt;
  
      &lt;s:List 
          width="100%" 
          height="50%"
          dataProvider="{_numbers}"&gt;
          &lt;s:itemRenderer&gt;
              &lt;fx:Component&gt;
                  &lt;s:IconItemRenderer labelField="label" /&gt;
              &lt;/fx:Component&gt;
          &lt;/s:itemRenderer&gt;
      &lt;/s:List&gt;
  
  &lt;/s:Application&gt;
  </code></pre>
  
  <p><strong>src/locale/en_US/resource.properties:</strong></p>
  
  <pre><code>menu.one=One
  menu.two=Two
  menu.three=Three
  menu.four=Four
  menu.five=Five
  menu.title=English
  </code></pre>
  
  <p><strong>src/locale/de_DE/resource.properties:</strong></p>
  
  <pre><code>menu.one=Eins
  menu.two=Zwei
  menu.three=Drei
  menu.four=Vier
  menu.five=Fünf
  menu.title=Deutsch
  </code></pre>
  
  <p><strong>src/locale/ru_RU/resource.properties:</strong></p>
  
  <pre><code>menu.one=Один
  menu.two=Два
  menu.three=Три
  menu.four=Четыре
  menu.five=Пять
  menu.title=Русский
  </code></pre>
  
  <p>In the project properties I have added <strong>Flex Build Path -> Source path</strong> of <code>src\locale\{locale}</code> </p>
  
  <p>And the <strong>Flex Compiler</strong> arguments of <code>-locale de_DE ru_RU en_US -allow-source-path-overlap=true</code></p>
  
  <p>In the screenshot above you can see that the german locale is shown properly initially.</p>
  
  <p>But when you touch the upper List to change the locale, then the lower List becomes empty.</p>
  
  <p>Why does it happen please?</p>
  
  <p>I have read the Adobe doc <a href="http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f3a.html#WS2db454920e96a9e51e63e3d11c0bf6119c-7fef" rel="nofollow noreferrer">Changing locales at run time with the ResourceManager</a> and few others, but couldn't figure out the cause yet.</p>
  
  <p>When <code>resourceManager.localeChain</code> is assigned a new array, does the locale switch happen synchronously or should I maybe listen for some event?</p>