The tutorials for using CSS in Flash seem pretty straightforward, but for some reason they just don’t work for me. I’m using this code:
this.createTextField("myText", 1, 100, 100, 300, 100);
myText.multiline = true;
myText.wordWrap = true;
myText.html = true;
var myFormat:TextField.StyleSheet = new Textfield.StyleSheet();
myFormat.onLoad = function(success) {
trace("yay");
if(success) {
myText.styleSheet = myFormat;
myText.htmlText = "<p class='big'>Yes!</p><p class='small'>It works.</p>";
} else {
myText.htmlText = "Aw.";
}
}
myFormat.load("default.css");
This is my CSS file:
.big, .small {
color: #000000;
}
.big {
font-size: 16px;
}
.small {
font-size: 10px;
}
When I Debug>Variables, there is one line in particular that seems to be the key:
Variable _level0.myFormat = undefined
Any ideas? I’m sure the answer must be simple, but I just can’t see it.