User Guide
766 Chapter 7: ActionScript for Flash
Returns
A reference to a TextField.StyleSheet object.
Description
Constructor; creates a TextField.StyleSheet object.
Example
The following example loads in a style sheet and outputs the styles that load into the document.
Add the following ActionScript to your AS or FLA file:
var my_styleSheet:TextField.StyleSheet = new TextField.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
writes to the log file:
Styles loaded:
.heading
.mainBody
The complete code for styles.css is found in the example for
TextField.StyleSheet.getStyle().
TextField.StyleSheet.clear()
Availability
Flash Player 7.
Usage
styleSheet.clear() : Void
Parameters
None.
Returns
Nothing.
Description
Method; removes all styles from the specified style sheet object.