AS3 嵌入资产 - “警告:无法解析损坏的数据”

发布于 2024-09-15 07:26:21 字数 1441 浏览 6 评论 0原文

我有一个 AS3 项目,我试图通过 [Embed] 元数据编译多个图像、配乐和视频。产品要求嵌入这些内容,因此网络传输不是一种选择。

我遇到了一些非常奇怪的行为 - 一种编译数据的间歇性损坏。有时,在项目编译后,我运行 swf,它会立即关闭并将“警告:无法解析损坏的数据”写入闪存日志。如果我删除二进制文件并清理项目,有时再次构建后它会运行良好。有时则不然。

这可能是这个问题最奇怪的部分,但有时当我看到该错误时,我可以将视频 [Embed] 行物理移动到文件末尾,然后清理项目,它将构建和运行没有问题。有时我将它们移回文件的开头,它会构建并运行良好。

看起来这可能是编译器中的一个错误。还有其他人经历过类似的事情吗?我的目标是 Flash 10.1 并使用 sprout (http://projectsprouts.org) 来构建我的项目。这是用于编译的 mxmlc 行(mxmlc Version 4.1.0 build 16076):

mxmlc -as3 -static-link-runtime-shared-libraries=true -debug -default-background-color=#ffffff -default-size 712 400 -output=bin/ProjectName.swf -source-path+=.preprocessed/src -source-path+=.preprocessed/assets .preprocessed/src/ProjectName.as

我尝试删除 -debug 编译器选项并添加 -optimize选项,但没有运气。

所有内容都通过 GNU C 预处理器运行以执行其他一些任务,所以也许我会尝试删除预处理器内容并对这些变量进行硬编码...我会尝试这样做并明天发布结果。

任何见解都将不胜感激。谢谢!

编辑:

该项目将使用嵌入到同一代码库中的不同资产进行动态编译,因此切换到 Flash Builder 之类的东西进行编译确实不是一个选择...它必须通过命令行 mxmlc。

更新:

事实证明,损坏的数据消息是由于使用 Photoshop 的“另存为网络”功能创建的图像造成的。如果我将它们直接保存为 PNG 图像,我不会收到该消息。然而,电影正确编译的间歇性似乎仍然是一个问题。现在,有时当项目编译时,它不会抛出任何编译器错误,但我会得到一个空白的 Flash 播放器窗口。在 Flash 播放器中右键单击会显示一个上下文菜单,其中显示一条消息:“电影未加载...”这似乎与首先通过 CPP 运行的内容无关。

[屏幕截图]

I've got an AS3 project where I'm trying to compile in several images, a soundtrack, and a video via [Embed] metadata. It's a product requirement that these be embedded, so network transfer is not an option.

I'm getting some really strange behavior - a sort of intermittent corruption of the compiled-in data. Sometimes after the project compiles, I run the swf and it closes immediately and writes "Warning: Failed to parse corrupt data" to the flash log. If I delete the binary and clean the project, sometimes it'll run fine after building it again. Sometimes it doesn't.

This is probably the strangest part about this problem, but sometimes when I see that error, I can physically move the video [Embed] lines to the end of the file, then clean the project, and it will build and run no problem. Sometimes I move them back to the beginning of the file and it builds and runs fine.

It kinda seems like it might be a bug in the compiler. Has anyone else experienced something similar? I'm targeting Flash 10.1 and using sprout (http://projectsprouts.org) to build my project. This is the mxmlc line that's being used to compile (mxmlc Version 4.1.0 build 16076):

mxmlc -as3 -static-link-runtime-shared-libraries=true -debug -default-background-color=#ffffff -default-size 712 400 -output=bin/ProjectName.swf -source-path+=.preprocessed/src -source-path+=.preprocessed/assets .preprocessed/src/ProjectName.as

I've tried both removing the -debug compiler option and adding the -optimize option, but no luck.

Everything is being ran through the GNU C preprocessor for some other tasks, so maybe I'll try removing the preprocessor stuff and hardcoding those variables...I'll try that and post the results tomorrow.

Any insight at all would be much appreciated. Thanks!

EDIT:

This project is going to be compiled dynamically with different assets being embedded into the same codebase, so switching to something like Flash Builder for compilation really isn't an option...it must be done via command-line mxmlc.

UPDATE:

Turns out the corrupted data message was due to images created with Photoshop's "Save for web" feature. If I save them outright as PNG images I don't get the message. However, the intermittent nature of the movie compiling properly still seems to be an issue. Now sometimes when the project is compiled it won't throw any compiler errors, but I get a blank flash player window. Right clicking in flash player shows a context menu with a message that says "Movie not loaded..." This doesn't appear to have anything to do with things being ran through CPP first.

[Screenshot]

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

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

发布评论

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

评论(2

扶醉桌前 2024-09-22 07:26:21

这显然是 Mac OS X 下 mxmlc 中的一个错误。发布此内容后,我观察到了其他一些非常奇怪的行为,因此我将整个代码库切换到 Windows 7。一切都按预期工作(仍然使用 Project Sprouts 作为构建工具)。

This is apparently a bug in mxmlc under Mac OS X. After posting this, I observed some other really strange behavior, so I switched the whole codebase to Windows 7. Everything works as expected there (still using Project Sprouts as a build tool).

旧情别恋 2024-09-22 07:26:21

Flash 构建器对此很满意。

您能否将您的问题仅针对视频或音乐,或者两者都存在问题?

Flash builder is fine with it.

Can you separate your issue for video or music only, or issue is true for both includes?

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