MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 682

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Example
The following example creates a new text field at runtime, called
the Stage,
,
css1_btn
applied to
, or clear the style sheet from the text field. Add the following
news_txt
ActionScript to your FLA or ActionScript file:
this.createTextField("news_txt", this.getNextHighestDepth(), 0, 0, 300,
200);
news_txt.wordWrap = true;
news_txt.multiline = true;
news_txt.html = true;
var newsText:String = "<p class='headline'>Description</p> Method; "
+ "starts loading the CSS file into styleSheet. The load operation is
asynchronous; "
+ "use the <span class='bold'>TextField.StyleSheet.onLoad</span> "
+ "callback handler to determine when the file has finished loading. "
+ "<span class='important'>The CSS file must reside in exactly the same "
+ "domain as the SWF file that is loading it.</span> For more information
about "
+ "restrictions on loading data across domains, see Flash Player security
features.";
news_txt.htmlText = newsText;
css1_btn.onRelease = function() {
var styleObj:TextField.StyleSheet = new TextField.StyleSheet();
styleObj.onLoad = function(success:Boolean) {
if (success) {
news_txt.styleSheet = styleObj;
news_txt.htmlText = newsText;
}
};
styleObj.load("styles.css");
};
css2_btn.onRelease = function() {
var styleObj:TextField.StyleSheet = new TextField.StyleSheet();
styleObj.onLoad = function(success:Boolean) {
if (success) {
news_txt.styleSheet = styleObj;
news_txt.htmlText = newsText;
}
};
styleObj.load("styles2.css");
};
clearCss_btn.onRelease = function() {
news_txt.styleSheet = undefined;
news_txt.htmlText = newsText;
};
682
ActionScript classes
and
css2_btn
clearCss_btn
news_txt
, are used to change the style sheet that is
. Three buttons on

Advertisement

Table of Contents
loading

Table of Contents