TextField text color changing (not animated)

Say I have a class that extends TextField and I want to have it set a default text color to black (0x000000) when initiated. Easy enough. But then say, when the XML finishes loading and the user has decided to change the color of that textfield to red (0xFF0000), what would be the easiest way to change the text color of that field?

The only way I can think to do it is to change the textformat color via public method? Would this be correct or is there an easier way?

Thanks ahead! :beer::pac:

Small example:


var my_color:uint = 0xFF0000;
var t:MyTextBox = new MyTextBox();
t.setTextColor(my_color);

class MyTextBox extends TextField {
  _fmt:TextFormat;
  _userColor:uint = null;

  function MyTextBox() {
    init();
  }

  private function init():void {
    setProperties();
    setFormat();
            
    this.text = "Default Text";
  }

  private function setProperties():void {
    this.multiline = false;
    this.wordWrap = false;
    this.width = 150;
    this.height = 24;
    this.x = 20;
    this.y = 20;
  }

  private function setFormat():void {
    _fmt = new TextFormat(new LucidaSansR().fontName, 10, 0xFFFFFF, null, null, null, null, null, "center");

    this.defaultTextFormat = _fmt;
  }

  public function setTextColor(new_color:uint):void {
    _userColor = new_color;

    // What would I put here, another text format?????
  }
}