actionscript-3 - Actionscript 3.0 嵌入字体 - 文本未出现

标签 actionscript-3 flash actionscript

我正在 ActionScript 3.0 中创建动态文本字段。和其他许多人一样,当我设置 .embedFonts = true;

时,我的文本消失了

ArialSlim 嵌入并导出为 ActionScript 。我已成功使用 trace(Font.enumerateFonts());

进行了测试

有趣的是,当我注释掉嵌入行(如下所示)时,字体可以正常工作。

或者,.setTextFormat(); 在没有 .embedFonts 行的情况下也可以正常工作。

所以我的问题是,为什么?在这种情况下我会遇到任何问题吗?

var divArray = new Array();
var x_Lbl_Array:Array = new Array();

var entries:int = 10;

var labelFormat:TextFormat = new TextFormat();
var arial:Font = new ArialSlim();    

labelFormat.font = arial.fontName;
labelFormat.size = 10;

var xVar:int = 0;

for(var loop:int = 0; loop < entries; loop++){
    x_Lbl_Array[loop] = new TextField();

    //x_Lbl_Array[loop].embedFonts = true;
    x_Lbl_Array[loop].antiAliasType = AntiAliasType.NORMAL;
    x_Lbl_Array[loop].defaultTextFormat = labelFormat;

    x_Lbl_Array[loop].x = xVar;
    x_Lbl_Array[loop].y = 165;
    x_Lbl_Array[loop].text = "test";

    mc.addChild(x_Lbl_Array[loop]);
    xVar++;
}

编辑: 我刚刚使用 .embedFonts = true; 从第 1 帧运行此代码,它起作用了...

也许我应该提到,我在实例化的 ActionScript 类内的方法中运行此代码时遇到问题。该类位于外部 .as 文件中。这有助于回答我的问题吗?

最佳答案

我尝试了你的代码,它对我有用(使用嵌入字体)

检查是否包含所有字符。 您可以设置字符范围,或创建一个包含所有字符的文本字段。

关于actionscript-3 - Actionscript 3.0 嵌入字体 - 文本未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9910883/

相关文章:

apache-flex - ActionScript :未定义的公共(public)变量?

actionscript-3 - 在 Actionscript 3 中查找前 3 个最接近的目标

Flash 生成器 "Unable to Connect"错误

ajax - 简单的 RTMP 网络摄像头脚本?

actionscript-3 - 单词 "prototype"在 ActionScript 中是什么意思?

actionscript-3 - AIR 的 EncryptedLocalStore 在桌面上的安全性如何?

apache-flex - 检查转换为数字的字符串是否实际上是 actionscript 中的数字的最简单方法

android - 设置 FlashDevelop 以便生成可在手机上运行的文件

actionscript-3 - 在 AS3 中保存/加载文件的一些好方法是什么?

actionscript-3 - 可以在AS3中保存XML文件