If I paste this in to an empty Flash document, it doesn’t work. Can anyone tell me why. The Publish settings are Flash Player 7 and ActionScript 2.
import TextField.StyleSheet;
var my_styleSheet:StyleSheet = new StyleSheet();
var styleObj:Object = new Object();
styleObj.color = "#cc0000";
styleObj.fontWeight = "bold";
styleObj.fontFamily = "sans-serif";
my_styleSheet.setStyle("headline", styleObj);
delete styleObj;
for (var i in my_styleSheet) {
trace(i+ ": " + my_styleSheet*)
for (var j in my_styleSheet*) {
trace(" "+ j + ": " + my_styleSheet*[j]);
for (var k in my_styleSheet*[j]) {
trace(" "+ k + ": " + my_styleSheet*[j][k]);
}
}
}
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.styleSheet = myStyleSheet;
news_txt.htmlText = newsText;