StyleSheet (TextField.StyleSheet)
1149
Returns
Boolean
-
false
if no parameter (
null
) is passed;
true
otherwise. Use the
onLoad()
callback
handler to check the success of a loaded StyleSheet.
Example
For an example of asynchronously loading style sheets using ActionScript 2.0, see the example
for
getStyle()
.
The following example loads the CSS file named styles.css into the StyleSheet object
my_styleSheet
. When the file has loaded 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()
.
See also
onLoad (StyleSheet.onLoad handler)
,
getStyle (StyleSheet.getStyle method)
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
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...