You want to apply formatting to text as it is entered into a text field by the user.
Apply a TextFormat object using the setNewTextFormat( ) method of the text field.
You should use the setNewTextFormat( ) method of a text field object to apply text formatting to text as it is entered by the user. You should create a TextFormat object as in Recipe 8.16 and then pass that object to the text field's setNewTextFormat( ) method:
myTextFormat = new TextFormat( ); myTextFormat.color = 0x0000FF; // Make the text blue. myTextField.setNewTextFormat(myTextFormat);
When you use setNewTextFormat( ), the formatting is applied to text that the user types into the field.