onLoad (StyleSheet.onLoad handler)

onLoad = function(success:Boolean) {}

Invoked when a load() operation has completed. If the StyleSheet loaded successfully, the success parameter is true. If the document was not received, or if an error occurred in receiving the response from the server, the success parameter is false.

Availability: ActionScript 1.0; Flash Player 7

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)