我有一个动态填充的文本字段。如果填充的文本不适合文本字段,则会调整文本大小。HTML 标记在动态填充的文本中正常工作,但前提是文本未调整大小。HTML 标记在调整大小的文本中被完全忽略。有任何想法吗?
文本字段的代码:
import flash.text.TextFormat;
import flash.text.Font;
//
function setDesc(str:String):void{
var fmtD:TextFormat;
var cfmtD:TextFormat = this.desc_txt.getTextFormat()==null ? this.desc_text.defaultTextFormat : this.desc_txt.getTextFormat();
var sizeD:int = 22;
desc_txt.htmlText = str;
while(sizeD>10 && sizeD<23 && desc_txt.textHeight>255){
sizeD--;
fmtD = new TextFormat(descFont.fontName,sizeD,0x000000,false, false,false);
desc_txt.htmlText = str;
desc_txt.setTextFormat(fmtD);
}
}
填充文本字段的代码:
function openDialog(e:MouseEvent){
dialog_window.doOpen();
switch(e.currentTarget.name){
case "btn_structure":
dialog_window.setTitle("Business Structure:");
dialog_window.setDesc("This topic discusses the <b>basic</b> structure of the business area.");
break;
case "btn_services":
dialog_window.setTitle("Services Provided:");
dialog_window.setDesc("This topic provides <i>information</i> about the services offered by the Client Billing Services unit.");
break;
}
}