User Guide

1150 ActionScript classes
Parameters
success:Boolean - A Boolean value that indicates whether the CSS file loaded successfully
(
true) or not (false).
Example
The following example loads the CSS file named styles.css into the StyleSheet object
my_styleSheet. When the file has finished loading successfully, the StyleSheet object is
applied to a TextField object named
news_txt.
import TextField.StyleSheet;
this.createTextField("news_txt", 999, 10, 10, 320, 240);
news_txt.multiline = true;
news_txt.wordWrap = true;
news_txt.html = true;
var my_styleSheet:StyleSheet = new StyleSheet();
my_styleSheet.onLoad = function(success:Boolean) {
if (success) {
news_txt.styleSheet = my_styleSheet;
news_txt.htmlText = "<p class=\"heading\">Heading goes here!"
+ "</p><p class=\"mainBody\">Lorem ipsum dolor "
+ "sit amet, consectetuer adipiscing elit, sed diam nonummy "
+ "nibh euismod tincidunt ut laoreet dolore magna aliquam "
+ "erat volutpat.</p>";
}
};
my_styleSheet.load("styles.css");
For the complete code for styles.css, see the example for getStyle(). For an example of
asynchronously loading style sheets using ActionScript 2.0, see the example for
getStyle().
See also
load (StyleSheet.load method), getStyle (StyleSheet.getStyle method)
parseCSS (StyleSheet.parseCSS method)
public parseCSS(cssText:String) : Boolean
Parses the CSS in cssText and loads the StyleSheet with it. If a style in cssText is already in
the StyleSheet, the StyleSheet retains its properties, and only the ones in
cssText are added or
changed.
To extend the native CSS parsing capability, you can override this method by creating a
subclass of the StyleSheet class.
Availability: ActionScript 1.0; Flash Player 7