【AS3代码】创建动态文本

package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFieldType;
    
    public class Main extends Sprite
    {    
        public function Main():void
        {
            //创建动态文本
            var txt:TextField = new TextField();
            txt.htmlText = "<b style='font-size:36px'>AS3开发AS3开发AS3开发AS3开发AS3开发</b>";
            txt.y = 100;
            txt.textColor = 0xff0000;            //文字颜色
            txt.background = true;
            txt.backgroundColor = 0x00ff00;
            txt.height=100;
            txt.multiline = true;                //可输入多行
            txt.type = TextFieldType.INPUT;      //文字类型
            txt.wordWrap = true;                 //是否自动换行
            txt.appendText("追加内容");
            this.addChild(txt);
            
            trace(txt.getLineLength(3));         //返回第三行的文本长度
            trace(txt.getLineText(3));           //返回第三行的文本内容
        }
    }
}
原文地址:https://www.cnblogs.com/kingfly/p/2445739.html