Flash Actionscript 添加字体样式,解决火星文不能显示 TLFTextFile

本文介绍了一种在Flex中使用ActionScript设置TLFTextField文本样式的具体方法。通过定义TextLayoutFormat对象来控制字体、大小及加粗等属性,并应用到TLFTextField组件上,实现了文本显示的自定义格式化。
public static function setCSS(myTLFTextField:TLFTextField){
            //var format1:TextLayoutFormat = new TextLayoutFormat();
            //format1.color = 0x660000;
            //format1.fontFamily = "Arial, Helvetica, _sans";
            //format1.fontSize = 14;
            //format1.paragraphSpaceBefore=0;
            //format1.paragraphSpaceAfter=20;
            //var format2:TextLayoutFormat = new TextLayoutFormat();
            //format2.color = 0x990000;
            //format2.fontSize = 16;
            //format2.fontWeight = FontWeight.BOLD;
            //tf.format = format2;            
            //var fmt:TextFormat = new TextFormat("微软简粗黑",10.8,null,100);
            //tf.autoSize = TextFieldAutoSize.CENTER;
            var myFormat:TextLayoutFormat = new TextLayoutFormat();
            //myFormat.textIndent = 8;
            //myFormat.color = 0x336633;
            myFormat.fontFamily = "Microsoft YaHei";
            myFormat.fontSize = 10.8;
            myFormat.fontWeight = FontWeight.BOLD;
            myTLFTextField.autoSize = TextFieldAutoSize.CENTER;
            var myTextFlow:TextFlow = myTLFTextField.textFlow;
            myTextFlow.hostFormat = myFormat;
            myTextFlow.flowComposer.updateAllControllers();
        }

 

转载于:https://www.cnblogs.com/liulf/archive/2013/01/18/2866137.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值