关于TextFormat,当文本首次通过非代码设置了其字体==内容之后,再通过TextFormat来改变其格式,如有设置字体,则被格式化的内容将不能显示。因此,可以设置字体以外的其它属性,而字体则最好不要设置。
function forMat(txt:TextField,index:int):void
{
var textFormat:TextFormat=new TextFormat();
//textFormat.size = 50;
//textFormat.font = "华文楷体";
//textFormat.bold=true;
textFormat.color = 0x00FF00;//绿色
//txt.defaultTextFormat = textFormat;
txt.setTextFormat(textFormat,index,index+1);
//trace(input_txt.text;//txt.setTextFormat(textFormat);
//txt.text=str;
}