User Guide

TextField.StyleSheet.getStyle() 767
Example
The following example loads a style sheet called styles.css into a SWF file, and writes the styles
that are loaded to the log file. When you click
clear_btn, all styles from the my_styleSheet
object are removed.
// Create a new style sheet object
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();
for (var i = 0; i<styles_array.length; i++) {
trace("\t"+styles_array[i]);
}
trace("");
} else {
trace("Error loading CSS");
}
};
// Start the loading operation
my_styleSheet.load("styles.css");
clear_btn.onRelease = function() {
my_styleSheet.clear();
trace("Styles cleared.");
var styles_array:Array = my_styleSheet.getStyleNames();
for (var i = 0; i<styles_array.length; i++) {
trace("\t"+styles_array[i]);
}
trace("");
};
TextField.StyleSheet.getStyle()
Availability
Flash Player 7.
Usage
styleSheet.getStyle(styleName:String) : Object
Parameters
styleName
A string that specifies the name of the style to retrieve.
Returns
An object.
Description
Method; returns a copy of the style object associated with the style named styleName. If there is
no style object associated with
styleName, null is returned.