【问题标题】:As3 flash text field resize vertically?As3 Flash文本字段垂直调整大小?
【发布时间】:2013-04-12 16:09:35
【问题描述】:

我正在制作一个聊天应用程序,我想将单个文本字段添加到 mc,以便用户可以自定义这些文本字段,即背景、字体和其他内容。为此,我必须获取文本字段的高度,因为我需要它来放置下一个文本字段(高度 = 下一个文本字段的 Y)

我尝试了多行和自动换行,但它只显示 1 行... 我也尝试过 AUTOSIZE = left 但是......它在最后增加了一个巨大的不必要的空白

代码如下 在此处输入代码`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;

}

【问题讨论】:

    标签: actionscript-3 flash height autosize


    【解决方案1】:

    修复它...我认为

     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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多