我有需要在 ActionScript 中设置为自动大小和粗体的文本字段。出于某种原因,当我应用粗体格式时, autosize=true 丢失了。据我所知,我正在按照正确的顺序做所有事情。非常感谢您对正在发生的事情的任何想法。谢谢!
以下是相关代码:
var categoryMenu:MovieClip = _root.createEmptyMovieClip("categoryMenu", 1005);
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = true;
for (var i:Number = 0; i<numCat; i++) {
var menu:MovieClip = categoryMenu.attachMovie("menu", "menu"+i,i);
menu._txt.txt.autoSize = true;
menu._txt.txt.text = gallData.getMenuGall.name[i];
//if i comment out the following line, the autosize works.
//if i leave it in, the autosize is lost. but i can't put this line
//before the autosize or i lose the bold
menu._txt.txt.setTextFormat(my_fmt);
...
}