Flex AS3 项目转换为 CS4

发布于 08-17 22:17 字数 1598 浏览 9 评论 0原文

有人有将 Flex 中的 AS3 项目(无 mxml)转换为 Flash CS4 的经验吗?是否有任何资源可以说明哪些内容在 Flex Builder 中有效但在 Flash 中无效,以及如何让项目运行?我在某处读到(例如)某些元数据标签不起作用。

如果我的所有代码都在 src 文件夹中,我是否应该在该文件夹中创建 .fla 文件,并从启动 Flex 项目的 .as 文件中复制所有代码?或者在其他地方创建 .fla 文件并在类路径中分配该 src 文件夹?另外,由于不熟悉 CS4 IDE,我是否需要创建一个新的 Flash 项目?

谢谢!


这就是我遇到的问题。 Flex AS3 中的代码如下所示:

    [Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF',  fontWeight = 'bold', fontName='ArialBold', unicodeRange='U+0020-U+0020,U+0021-...')] //a bunch of other unicode
    public static var _VerdanaFontBold:Class;  

    [Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial', unicodeRange='U+0020-U+0020...')] //a bunch of other unicode
    public static var _VerdanaFont:Class;  

在我的文本出现的扩展文本字段的构造函数中,我有:

        Font.registerFont(_VerdanaFontBold);
        Font.registerFont(_VerdanaFont); 

CS4 不允许使用嵌入元数据。所以我已经评论了。在 CS4 中,我知道我应该在设计模式下创建一个空白文本字段,我已经这样做了。然后我可以选择要嵌入的字体。我选择了 verdana(大小写、标点符号、数字等)。

当我在 CS4 中运行应用程序时,文本字段为空。

我做错了什么?我是否需要为 verdana 字体指定实例名称 _VerdanaFont?我不这么认为,因为我还必须注释掉 Font.registerFont 。事实上,我将字体嵌入到空白文本字段中,而不是我设置的文档类调用的字体,这应该不重要,对吧——字体应该嵌入到 swf 中并可供使用。但它是空白的。

有人知道在这里可以做什么吗?

编辑:考虑到现在不起作用的明显原因与字体未正确显示有关,我最好将其创建为一个新问题。此外,还有比上面提供的有关文档类的链接中的描述更清晰的描述,此处:http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in- actionscript-30-教程/

Has anyone got experience in converting AS3 projects (no mxml) in Flex, to Flash CS4? Are there any resources out there as to what works in Flex Builder that doesn't work in Flash, and how to get the project running? I read somewhere that (for instance) certain Metadata tags don't work.

If I've got all my code in the src folder, should I just create the .fla file in that folder and basically copy all code from the .as file which launched the Flex project? Or create the .fla file somewhere else and point assign that src folder in the classpath? Also, not being familiar with the CS4 IDE, do I create a new Flash Project?

Thanks!


So here's the issue I'm having. The code in the Flex AS3 looks like this:

    [Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF',  fontWeight = 'bold', fontName='ArialBold', unicodeRange='U+0020-U+0020,U+0021-...')] //a bunch of other unicode
    public static var _VerdanaFontBold:Class;  

    [Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial', unicodeRange='U+0020-U+0020...')] //a bunch of other unicode
    public static var _VerdanaFont:Class;  

And in constructor of the extended textfield in which my text appears I have:

        Font.registerFont(_VerdanaFontBold);
        Font.registerFont(_VerdanaFont); 

CS4 doesn't allow use of the Embed metadata. So I've commented that out. In CS4, I understand that I'm supposed to create a blank textfield in design mode, which I've done. I then can select fonts to embed. I've selected verdana (upper and lower case, punctuation, number, etc).

When I run the app in CS4, the textfield is blank.

What am I doing wrong? Do I need to give the verdana font an instance name of _VerdanaFont? I wouldn't think so, since I've had to comment out the Font.registerFont as well. The fact that I'm embedding the font in a blank textfield, and not the one that's called by the document class I've set, shouldn't matter, right -- the font should just be embedded in the swf and available for use. But it's blank.

Does anyone know what to do here?

Edit: Well given that the apparent reason this isn't working now has to do with fonts not showing up correctly, I better create that as a new Question. Also, there's a clearer description than the one in the link provided above regarding the document class, here: http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in-actionscript-30-tutorial/

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

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

发布评论

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

评论(1

街角卖回忆2024-08-24 22:17:59

这确实取决于。如果它只是一个仅依赖于playerglobal.swc的纯AS3项目,那么它应该相当容易。只需复制您的 .as 文件并将它们添加到您的新项目中,就像 Cameron 所建议的那样。

但是,如果您编写了一个依赖于任何其他 SWC(flex.swc、framework.swc 等)的纯 AS3 Flex 应用程序,那么这是不可能的,因为 CS4 无法使用 SWC 文件。如果你用 google 搜索一下,你可能会发现有人将 SWC 反汇编成各种 .abc 文件和一个充满资源的 SWF,但你可能最终不得不将整个 Flex 框架和所有支持代码嵌入到最终的 SWF 中,这会变得臃肿真是太棒了。

It really depends. If it's just a pure AS3 project that relies only on playerglobal.swc it should be fairly easy. Just copy your .as files and add them to your new project as Cameron has suggested.

If however you've written a pure AS3 Flex app that relies on any of the other SWCs (flex.swc, framework.swc, etc) it's not really possible, as CS4 can't use SWC files. If you google around you might find somebody who's disassembled the SWC into various .abc files and a SWF full of resources, but you'll probably end up having to embed the entire Flex framework and all support code into your final SWF, which will bloat it big-time.

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