package {
import flash.text.TextField;
import flash.text.StyleSheet;
import flash.text.TextFieldAutoSize;
public class MyTF extends TextField {
public var
color:uint,
size:int
public function MyTF( color:uint, size:int) {
super();
color = color; // setting color and size
size = size;
init(); //initialize
}
private function init():void
{
autoSize = TextFieldAutoSize.LEFT;
var style:StyleSheet = new StyleSheet();
style.setStyle('span', {color: 0xFF0000, fontSize: 24});
styleSheet = style;
htmlText = '<span>test</span>';
//after creating an object of this class the text Style is not changing
}
}
}
为什么创建此类的实例后 htmlText 样式没有改变?有什么不对?