Setting Styles on UITextField Revisited

Written by

In a previous post I highlighted how I found that certain styles where getting lost on my UITextField’s especially in renderers etc. I still noted people were finding this a continued issue and I have found a better way of handling this now which I have so far had 100% success with. Please see the code below:

1
2
var customTxtField: CustomUITextField = new CustomUITextField();             
customTxtField.styleName = "styleCustomText";
1
2
3
4
5
6
7
8
9
//Add this into a Custom Class that extends UITextField
override public function styleChanged( styleProp:String ):void 
{
     super.styleChanged( styleProp );
          
     var c:Number = getStyle("textColor");
          
     setColor( c );
}
1
2
3
4
.styleCustomText
{
  textColor: #FF0000;
}

Comments