Actionscript 3 Actionscript 3文本字段高度

Actionscript 3 Actionscript 3文本字段高度,actionscript-3,height,textfield,Actionscript 3,Height,Textfield,我需要将文本字段autosize属性设置为NONE,以确保HTML链接不会在滚动时跳转 但是,在执行此操作时,如何设置textfield height属性以显示所有文本而不滚动 我尝试了以下方法,但由于某种原因我无法理解,它挤压了我文本的高度: htmlTextField.autoSize = TextFieldAutoSize.LEFT; htmlTextField.htmlText = htmlText; var recordedHeight:Number = htmlTextFiel

我需要将文本字段autosize属性设置为NONE,以确保HTML链接不会在滚动时跳转

但是,在执行此操作时,如何设置textfield height属性以显示所有文本而不滚动

我尝试了以下方法,但由于某种原因我无法理解,它挤压了我文本的高度:

htmlTextField.autoSize = TextFieldAutoSize.LEFT;   
htmlTextField.htmlText = htmlText;
var recordedHeight:Number = htmlTextField.textHeight;
htmlTextField.autoSize = TextFieldAutoSize.NONE;
htmlTextField.height = recordedHeight + htmlTextField.getTextFormat().leading + 1;
文本字段有一个完整的路径,所以这可能会绊倒你

package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;

    [SWF(frameRate="30", backgroundColor="#FFFFFF", width="500", height="500")]
    public class TextfieldHeight extends Sprite
    {
        public function TextfieldHeight()
        {
            var textFormat:TextFormat = new TextFormat();
            textFormat.size = 11;
            textFormat.font = "Georgia";

            var htmlTextField:TextField = new TextField();
            htmlTextField.setTextFormat( textFormat );
            htmlTextField.width = 250;
            htmlTextField.border = true;
            htmlTextField.wordWrap = true;
            htmlTextField.autoSize = TextFieldAutoSize.NONE; 
            htmlTextField.htmlText = '<a href="http://www.google.com">Lorem ipsum dolor</a> sit amet, consectetur adipiscing elit. Aliquam sodales, eros at convallis viverra, risus mauris euismod tortor, ac imperdiet sem augue vitae risus. Morbi ut sem neque. Vestibulum accumsan posuere augue, eu consectetur nibh porttitor eget. Sed suscipit sodales dui id pharetra. Vivamus quis hendrerit lectus. Vivamus interdum, felis a convallis dictum, libero erat aliquet massa, non placerat neque augue quis lacus. Aliquam viverra sem ultrices leo lacinia eu dignissim dolor ullamcorper. Etiam ullamcorper tincidunt velit, a vulputate sapien consequat quis.';
            htmlTextField.height = htmlTextField.textHeight + 4;

            this.addChild( htmlTextField );
        }
    }
}
包
{
导入flash.display.Sprite;
导入flash.text.TextField;
导入flash.text.textfield自动调整大小;
导入flash.text.TextFormat;
[SWF(frameRate=“30”,backgroundColor=“#FFFFFF”,width=“500”,height=“500”)]
公共类TextfieldHeight扩展了Sprite
{
公共函数TextfieldHeight()
{
var textFormat:textFormat=new textFormat();
textFormat.size=11;
textFormat.font=“格鲁吉亚”;
var htmlTextField:TextField=newtextfield();
htmlTextField.setTextFormat(textFormat);
htmlTextField.width=250;
htmlTextField.border=true;
htmlTextField.wordWrap=true;
htmlTextField.autoSize=TextFieldAutoSize.NONE;
htmlTextField.htmlText='坐在阿梅特,奉献给精英们。阿利奎姆·索达莱斯,维韦拉康瓦利斯的厄洛斯,里斯·莫里斯·尤伊斯莫德·托托,奥古斯·奥古斯·奥古斯·奥古斯·奥古斯·奥古斯·奥古斯·奥古斯·奥古斯·奥古斯特的前庭,欧盟奉献给埃吉特·尼伯·波特·奥古斯特的圣殿。在法雷特拉的酒馆里为索达莱斯提供服务。维瓦摩斯·奎斯·亨德雷特·莱斯特·莱斯特·莱斯特·莱克斯·奥古斯特·奥古斯特·奥古斯特嗯,这是一句令人信服的名言,自由女神阿利奎特·马萨,无地方时的奥古斯·奎斯·拉克斯。阿利奎姆·维韦拉是一位杰出的欧洲政要多洛·乌兰科珀。埃蒂姆·乌兰科珀·廷西蒙特·维利特,一位贪婪的智者;
htmlTextField.height=htmlTextField.textHeight+4;
this.addChild(htmlTextField);
}
}
}
如果你去阅读。
你会看到的。

返回flash.text:TextFormat-表示 指定文本的格式属性

现在,如果你看一下,你会发现默认值几乎都是0

我很久以前就遇到过这个问题,我发现唯一的解决办法就是选择一些文本,然后抓取,然后取消选择文本

我确信还有另外一种方法可以做到这一点,但正如我所说,这是我的一轮攻击