As3 flash文本字段垂直调整大小?

时间:2013-04-12 16:09:35

标签: actionscript-3 flash height autosize

即时制作聊天应用程序,我想将单独的文本字段添加到mc,以便用户可以对这些文本字段进行成本化,即背景,字体和内容。要做到这一点,我必须得到文本字段的高度,因为我将需要它来放置下一个文本字段(高度=下一个文本字段的Y)

我尝试了多行和wordwrap,但它只显示了1行... 我还试过AUTOSIZE =左 但是......它在最后添加了一个巨大的不必要的空白区域

继承人的代码     在这里输入代码`for(i = 0; i

// Apply some text to the textfield
boxMC.txTitle.htmlText ="<div style='width:50px'>Instance:aefvasdfawe efaegfawegfaw     egawerg alejr joaej alejuf owirt a iajsejrt a aopeu rt tauwe taiej r aiejrt a mc"+nextYPos+"</div>";
//attach the newly created instance to the container
myContent.addChild(boxMC);
//set y value for next item
boxMC.txTitle.width = 100;
boxMC.txTitle.autoSize = "100";
boxMC.txTitle.wordWrap = true;
boxMC.txTitle.multiline = true;
nextYPos+=boxMC.txTitle.height;

}

1 个答案:

答案 0 :(得分:0)

修好了......我想

 boxMC.txTitle.width = apW-30;
 boxMC.txTitle.wordWrap = true;
 boxMC.txTitle.multiline = true;
 if(boxMC.txTitle.textHeight == 15)
    { var theight = 9; }
 else { theight = 0; }

 boxMC.txTitle.height = boxMC.txTitle.textHeight + 4;
 myContent.addChild(boxMC);
 nextYPos+=boxMC.txTitle.textHeight + theight + 4 + 6;
相关问题