Using ActionScript 3.0 Components |
|
|
|
| Customizing the UI Components > Customizing the Label > Using styles with the Label | |||
You can set style properties to change the appearance of a label instance. All text in a Label component instance must share the same style. The Label component has a textFormat style, which has the same attributes as the TextFormat object and allows you to set the same properties for the content of Label.text as you can for a regular Flash TextField. The following example sets the color of text in a label to red.
To change the color of a label's text:a_label.Color me red
/* Create a new TextFormat object, which allows you to set multiple text properties at a time. */
var tf:TextFormat = new TextFormat();
tf.color = 0xFF0000;
/* Apply this specific text format (red text) to the Label instance. */
a_label.setStyle("textFormat", tf);
For more information about Label styles, see the Label class in the ActionScript 3.0 Language and Components Reference.
|
|
|
|