简体   繁体   English

设置动态文本字段时,链接的SWC /源中的AS3嵌入字体将消隐

[英]AS3 Embedded font in linked SWC/source blanks out when setting dynamic text field

Okay, that's a fairly complicated title up there, so I'll explain the setup that's causing this error first. 好吧,那是一个相当复杂的标题,所以我将首先解释导致此错误的设置。

I've got a number of related projects set up in Flash Builder. 我在Flash Builder中设置了许多相关项目。 Each project gets its graphical assets from an exported SWC file (or multiple SWC files.) This works fine, but I wanted to create a shared project that contains stuff used across all projects. 每个项目从导出的SWC文件(或多个SWC文件)获取其图形资源。这很好,但我想创建一个包含所有项目中使用的东西的共享项目。 The first item in there is a screen with a number of clips containing dynamic text fields on them. 其中的第一项是一个屏幕,其中包含许多包含动态文本字段的剪辑。 This screen (and associated assets) are exported to a SWC and then I have written code in the shared project to add functionality to the screen and buttons. 此屏幕(和相关资产)将导出到SWC,然后我在共享项目中编写代码以向屏幕和按钮添加功能。 I'm using 2 fonts, both are embedded. 我使用2种字体,都是嵌入式的。

Both show up just fine in my test harness, but when I link the shared SWC and src folder (which is required in order to use this code/assets in the other projects) the textfields blank out if I try to set their text properties. 两者都在我的测试工具中显示得很好,但是当我链接共享SWC和src文件夹(为了在其他项目中使用此代码/资产所需)时,如果我尝试设置其文本属性,则文本字段会消隐。 If I leave the default text (set in the FLA) it shows up, and the static text fields in the FLA also show up, it's only when I set the text property. 如果我保留默认文本(在FLA中设置)它会显示,并且FLA中的静态文本字段也会显示,只有在我设置text属性时才会显示。

I've tried a number of combinations, including removing embedding, exporting for ActionScript, setting all textfields in the shared project to dynamic, all with no luck. 我尝试了很多组合,包括删除嵌入,导出ActionScript,将共享项目中的所有文本字段设置为动态,都没有运气。 The main project does have the same font embedded, and I've checked that the same glyphs are selected in both the main and shared projects. 主项目嵌入了相同的字体,我检查了在主项目和共享项目中选择了相同的字形。

I realize this is a rather complicated setup, but I have yet to find a workflow to allow a designer and developer to work on large projects that is better (but I'd love to hear one!) 我意识到这是一个相当复杂的设置,但我还没有找到一个工作流程,允许设计师和开发人员处理更好的大项目(但我很想听到一个!)

Had the same problem last night. 昨晚有同样的问题。 Solved this morning.. 今天早上解决了..

  1. Flash CS5's new interface for embedding a font looks highlighted but you need to ensure that the checkbox is also selected. Flash CS5用于嵌入字体的新界面突出显示,但您需要确保也选中该复选框。
  2. Flash Builder 4, (and Flex), files need to be manually refreshed after updating your SWC file, as the system lags for some reason. 更新SWC文件后,需要手动刷新Flash Builder 4(和Flex)文件,因为系统因某种原因而滞后。

These two things together can lead to some unnecessary back and forth. 这两件事在一起会导致一些不必要的来回。

To summarize there were a couple of key points for me that solved it: 总结一下,我有几个关键点可以解决它:

  1. In Flash embed the required font in the standard manner, no need to Export for ActionScript. 在Flash中以标准方式嵌入所需的字体,无需为ActionScript导出。 If you publish the SWC and rebuild from your IDE you'll still be missing characters. 如果您发布SWC并从IDE重建,您仍然会丢失字符。
  2. FIRST KEY POINT : In Flash change the font of the dynamic text field to _sans. 第一要点 :在Flash中,将动态文本字段的字体更改为_sans。 Publish the SWC and rebuild from your IDE, all characters should now be present but of course the font is incorrect. 发布SWC并从IDE重建,现在应该存在所有字符,但当然字体不正确。
  3. SECOND KEY POINT : Jump back to Flash and once again change the font of the dynamic text field making sure to select the font that matches the name you input in step 1 when embedding. 第二个要点 :跳回Flash并再次更改动态文本字段的字体,确保选择与嵌入时在步骤1中输入的名称相匹配的字体。 This font will be in a section of its own near the top of the font list and will have an asterisk appended to the name you entered. 此字体将位于字体列表顶部附近的一个部分中,并且将在您输入的名称后附加一个星号。
  4. Once again publish the SWC and rebuild from your IDE and you should find everything working as expected. 再次发布SWC并从IDE重建,您应该发现所有内容都按预期工作。

Forcing a rebuild with a system font in step 2 seems to flush something out and gets everything working properly but it's also important you select the embedded version of the font in step 3 and not just the normal version. 在步骤2中强制使用系统字体进行重建似乎可以清除某些内容并使一切正常工作,但是在步骤3中选择字体的嵌入版本并且不仅仅是普通版本也很重要。

Try embeding the font within the TextField. 尝试在TextField中嵌入字体。 That works for me. 这对我行得通。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM