views:

53

answers:

0

Hi,

I have written the following test

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    creationComplete="{init()}"
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
    viewSourceURL="srcview/index.html">
    <mx:NumberValidator source="{testInput}"
        property="text" minValue="0" domain="real" 
        trigger="{testInput}" triggerEvent="change"
        valid="testValid=true;"
        invalid="testValid=false;"
        />
    <mx:Script>
        <![CDATA[
     private var testValid : Boolean = true;

            private function init():void{

                Languages.setResources(resourceManager);
            }
            private function changeLocale(locale:String):void{
                resourceManager.localeChain=[locale];
            }
        ]]>
    </mx:Script>
    <mx:ApplicationControlBar width="400">
        <mx:Label text="{resourceManager.getString('myResources','TITLE')}"  width="100%"/>
        <mx:Button label="eng" click="changeLocale('en_US')" />
        <mx:Button label="ita" click="changeLocale('it_IT')" />
     <mx:TextInput text="" id="testInput" width="40" />
    </mx:ApplicationControlBar>
</mx:Application>

with the following resources

package  
{
    /**
     * ...
     * @author Sebastian Müller
     */
    public class Languages
    {
     import mx.resources.IResourceManager;
    import mx.resources.ResourceBundle;

     public function Languages() {}
     public static function setResources(resourceManager:IResourceManager):void{


      var myResources:ResourceBundle=new ResourceBundle("en_US","myResources");
      myResources.content['TITLE']="Test";
      resourceManager.addResourceBundle(myResources);


      myResources=new ResourceBundle("it_IT","myResources");
      myResources.content['TITLE']="TestItalian";
      resourceManager.addResourceBundle(myResources);

      resourceManager.update();

     }  
    }

}

Now the following error occurs. When I start the application my number validation works as expected. When I afterwards switch to italian the number validator don't work anymore.

Do the following steps

  1. Type in a number in the text field
  2. Switch to italian
  3. Type in a letter => the text field does not turn into red

Any ideas?