I think I have some fundamental lack of understanding here. I’m trying to use CSS to specify how some HTML text in a text field is rendered. Specifically, I want my bold text to be a bit larger and different color. I have this test code:
[as]var tf:TextField = new TextField();
tf.width = 200;
tf.multiline = true;
tf.wordWrap = true;
addChild(tf);
var css:String = “h1 { color:#ff0000; font-size: 14;}”;
//var css:String = “b { color:#ff0000; font-size: 14;}”;
var ss:StyleSheet = new StyleSheet();
ss.parseCSS(css);
tf.styleSheet = ss;
tf.htmlText = "
This is bold text here.";[/as]
Create a text field, a CSS selector, a style sheet that parses the CSS. Apply it to a text field, assign it some html text. The above works fine, making the h1 header text appear in red. But if I uncomment line 8, and comment the one above it, effectively changing the “h1” to a “b”, nothing happens. The bold text is still bold, but not colored and same size as the rest.
I’m no CSS expert, but it seems this kind of thing should be possible. Is this just a funky Flash text field implementation of CSS, or am I not grasping some concept about CSS?