Flash:如何在多个影片剪辑中与文本字段共享嵌入字体

发布于 2024-09-29 02:04:50 字数 758 浏览 0 评论 0原文

经过大量的实验和阅读许多文章、问答,我仍然没有找到问题的答案,然后我决定在很棒的 stackoverflow 论坛上提出我的问题:-)

我的项目的设置如下: - 在Flash Builder 4中创建一个AS3项目(Main.as3proj),并在其中编写源代码; - 在 Flash CS5 中创建图形资源; - 加载AS3项目中的图形资源;

在图形资源(swf)中,有文本字段,我们希望在文本字段中使用嵌入字体。但我们不想在所有 swf 中嵌入字体,我们希望创建一个 swf 作为字体库 (FontLib.swf),嵌入所有图形资源 (swf) 所需的所有字体。

将 FontLib.swf 加载或嵌入到主应用程序 (Main.swf) 后,嵌入的字体可用:

TextField.isFontCompatible(myFontName, myFont)

为 true。当我在运行时创建带有嵌入字体的 TextField 时,它工作得很好。

但除此之外,我想在其他图形资源中使用文本字段的嵌入字体,就像我在开头所描述的那样,但是当我尝试更改影片剪辑中动态文本字段的文本时,文本字段将消失。 (在更改文本之前,它可以显示,因为Flash CS5自动嵌入了fla/swf文件中已输入的字符的字体)。

我尝试克隆具有与影片剪辑中的文本字段相同属性的文本字段,并替换旧的文本字段,正如我所说,这与在运行时创建的其他文本字段一样。但我在克隆和替换影片剪辑中的文本字段时遇到其他问题。

我想知道是否有一种方法可以指示 Flash 播放器对影片剪辑中的文本字段使用外部加载的嵌入字体。

After a lot of experiments and reading many articles, Q&As, I still didn't find the answers to my problem, then I decided to ask my question at great stackoverflow forum:-)

The setup of my project is as follows:
- Create an AS3 project in Flash Builder 4 (Main.as3proj), and write source code in it;
- Create graphical assets in Flash CS5;
- Load the graphical assets in the AS3 project;

In the graphical assets (swfs), there are text fields, we would like to use Embedded fonts for the text fields. But we don't want to embed the fonts in all swfs, we want to create a swf as a font library (FontLib.swf), that embed all the fonts needed across all the graphical assets (swfs).

After loading or embedding the FontLib.swf to the main application (Main.swf), the embedded fonts is availabe:

TextField.isFontCompatible(myFontName, myFont)

is true. And when I create a TextField with the embedded font at runtime, it works fine.

But besides this, I want to use the embedded fonts for the TextFields in other graphical assets like what I described at the begging, but when I try to change the text for the dynamic text field in a movie clip, the text field will disappear. (Before changing the text, it can be displayed because Flash CS5 automatically embed the fonts for the characters already input in the fla/swf file).

I tried to clone the text field with the same properties of the text field in the movie clip and replaced the old one, as I said, this works as other text fields created at run time. But I have other problem with cloning and replacing the text fields in movie clip.

I wonder if there is a way to instruct the flash player to use the externally loaded embedded fonts for the text fields in movie clip.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乞讨 2024-10-06 02:04:50

在 CS5 IDE 中:

  • 选择包含要嵌入的字体的文本字段。
  • 选择嵌入... 打开字体嵌入对话框。
  • 在右侧面板中,选择 ActionScript 选项卡。
  • 在标题共享的最底部,选中显示导入运行时共享的框。
  • 在显示URL的文本字段中,您输入一个指向的URL嵌入字体的 SWF 文件。

现在,带有您在 url 中指定的嵌入字体的 SWF 将自动由 Flash 播放器加载。

In the CS5 IDE :

  • Select the textfield with the font you want embedded.
  • Selected Embed... to open theFont Embedding dialogue.
  • In the right-hand side panel select the ActionScript tab.
  • At the very bottom under the heading Sharing check the box that says Import for runtime sharing
  • Inside the textfield that says URL you enter a url pointing to the SWF file where you have embedded the font.

Now the SWF with the embedded font that you specified in the url will automatically be loaded by the flash player.

允世 2024-10-06 02:04:50

我遇到了同样的问题,我将 movieClip 文本字段的字体更改为应用程序中的普通文本字段,但它没有显示我的新文本。我必须添加 Font.registerfont(myfont) 以便将应用程序中的嵌入字体共享到 movieclip swf。

I had the same problem, I changed the font of my movieClip textfield as an ordinary textfield in the application but it didn't dsplay my new text. I had to add Font.registerfont(myfont) so the embedded font in my application is shared to the movieclip swf.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文