【AS3代码】设置动态文本格式(颜色,大小等等)


package
{
     import flash.display.Sprite;
     import flash.text.TextField;
     import flash.text.TextFieldType;
     import flash.text.TextFormat;         // 文字格式类
    
     public  class Main  extends Sprite
    {    
         public  function Main():void
        {
             var format:TextFormat = new TextFormat();
            format.bold =  true;
            format.color = 0xff0000;
            format.size = 40;
            format.underline =  true;                 // 带下划线
            format.url = "http://www.baidu.com";
            format.target = "_blank";
            
             var txt:TextField = new TextField();
            txt.text = "AS3开发";
            txt.setTextFormat(format);                 // 格式绑定下
            txt.width = 300;
            txt.height = 300;
            
            this.addChild(txt);
        }
    }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM