Using styles with the TextArea

The TextArea component's styles specify values for its skins, padding, and text format when the component is drawn. The texFormat and disabledTextFormat styles govern the style of the text that the TextArea displays. For more information about the skin style properties, see Using skins with the TextArea.

The following example sets the disabledTextFormat style to change the appearance of text when the TextArea is disabled but the same process applies to setting the textFormat style for an enabled TextArea.

To set the disabledTextFormat style for a TextArea:

  1. Create a new Flash file.
  2. Drag a TextArea component to the Stage and give it an instance name of myTa.
  3. Add the following code to the Actions panel on Frame 1 of the main Timeline.
    var tf:TextFormat = new TextFormat();
    tf.color = 0xCC99FF;
    tf.font = "Arial Narrow";
    tf.size = 24;
    myTa.setStyle("disabledTextFormat", tf);
    myTa.text = "Hello World";
    myTa.setSize(120, 50);
    myTa.move(200, 50);
    myTa.enabled = false;
    
  4. Select Control > Test Movie.