Hello,

I'm having a problem where input fields that fail validation don't 
pick up a borderColor style from a runtime stylesheet.  I've got a 
small test case below with a NumberValidator hooked up to a TextInput 
and two buttons that load/unload some styles.

If you type a number in the field and hit the two buttons, it will 
change the border color and change the alignment of the text.  Then 
type in some letters (to make the field fail validation), then a 
number again to correct the error.  Now the buttons will only change 
the text alignment - the border color of the field does not change.

I guess the red failed-validation border is messing things up 
somehow - does anyone know of a fix?

Text.mxml
---------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" creationComplete="creationHandler()">
  
  <mx:Script>
    <![CDATA[
      import mx.validators.NumberValidator;
      private var validator:NumberValidator = new NumberValidator();
    
      public function creationHandler():void {
        validator.source = input1;
        validator.property = "text";
      }
    
      public function clearStyles():void {
        StyleManager.unloadStyleDeclarations("style.swf");
      }
      
      public function loadStyles():void {
        StyleManager.loadStyleDeclarations("style.swf");
      }
    ]]>
  </mx:Script>
  
  <mx:Style>
    TextInput {
      borderStyle: solid;
      borderThickness: 3;
      borderColor: #0000ff;
      textAlign: left;
    }
  </mx:Style>
  
  <mx:ApplicationControlBar dock="true">
    <mx:Button label="blue" click="clearStyles()"/>
    <mx:Button label="green" click="loadStyles()"/>
  </mx:ApplicationControlBar>
  
  <mx:TextInput id="input1" x="10" y="10"/>
</mx:Application>

style.css
---------
TextInput {
  borderColor: #00ff00;
  textAlign: right;
}

Reply via email to