Using ActionScript 3.0 Components |
|
|
|
| Customizing the UI Components > Setting styles > Setting a style for all instances of a component | |||
You can set a style for all instances of a component class using the static setComponentStyle() method of the StyleManager class. For example, you can set the color of text to red for all Buttons by first dragging a Button to the Stage and then adding the following ActionScript code to the Actions panel on Frame 1 of the Timeline:
import fl.managers.StyleManager; import fl.controls.Button; var tf:TextFormat = new TextFormat(); tf.color = 0xFF0000; StyleManager.setComponentStyle(Button, "textFormat", tf);
All Buttons that you subsequently add to the Stage will have red labels.
|
|
|
|