0
我有一個動態填充的文本字段。如果填充的文本不適合文本字段,則文本會被調整大小。 HTML標籤可以在動態填充的文本中正常工作,但前提是文本不會被調整大小。 在調整大小的文本中忽略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;
}
}
在這種情況下,HTML標記工作,但調整大小不。 – 2012-07-23 16:49:56
奇怪,請檢查我的編輯,看看它是否可以幫助你... – danii 2012-07-23 17:09:09
255是文本框的高度。 – 2012-07-23 17:24:55