StyleSheet constructor

public StyleSheet()

Creates a StyleSheet object.

Availability: ActionScript 1.0; Flash Player 7

Example

The following example loads in a style sheet and traces the styles that load into the document. Add the following ActionScript to your ActionScript or FLA file:

import TextField.StyleSheet;
var my_styleSheet:StyleSheet = new StyleSheet();
my_styleSheet.onLoad = function(success:Boolean) {
    if (success) {
        trace("Styles loaded:");
        var styles_array:Array = my_styleSheet.getStyleNames();
        trace(styles_array.join(newline));
    } else {
        trace("Error loading CSS");
    }
};
my_styleSheet.load("styles.css");

The styles.css file contains two styles, called .heading and .mainbody, so the following information is displayed in the Output panel:

 Styles loaded:
 .heading
 .mainBody

The complete code for styles.css is found in the example for getStyle().

See also

getStyle (StyleSheet.getStyle method)