flash中增加文本。使用了消除锯齿:可读性消除锯齿。发现不嵌入字体的无法动态改动里面的文字,但嵌入字体的话会造成swf文件过大。

终于还是选择了使用设备字体,并选择了黑体。出了一个问题。文字没有加粗效果。样式无法选择bold。通过as3.0代码解决的这个问题。

必须在设置完text后再setTextFormat才有效。


var txtFormat:TextFormat = new TextFormat();
txtFormat.font = "黑体";
txtFormat.size = 22;
txtFormat.bold = true;
txtFormat.color= 0xFFFF00;


var sName:String = stage.loaderInfo.parameters['nickname'];
if(sName)
{
nickname.text = sName.slice(0,12);
nickname.setTextFormat(txtFormat);
}

var sReward:String = stage.loaderInfo.parameters['reward'];
if(sReward)
{
reward.text =  "\""+ sReward.slice(0,12) +"\"";
reward.setTextFormat(txtFormat);
}


相关文章:

  • 2021-07-08
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-10
  • 2021-11-11
  • 2021-12-14
  • 2022-01-05
  • 2021-06-11
  • 2022-01-16
相关资源
相似解决方案