AS3 中的 PNG alpha 透明度 - 未知文件类型

发布于 2024-08-27 20:22:32 字数 1425 浏览 3 评论 0原文

减少选项后,我们遇到了 PNG 和 ActionScript 3 (AS3) 的问题。

当加载具有 alpha 透明度的 PNG 8 或 PNG 32 时,我们在 Flash 中报告以下错误:-

“错误 #2124:加载的文件是未知类型”

现在,我们正在处理一些问题旧图像,似乎这个问题并不普遍 - 一些被认为是 32 位 alpha PNG 的图像正在加载。但是,一些结论:-

  • 将一张 32 位 alpha 图像(不适用于 AS3)转换为 PNG 8 索引透明度确实有效。
  • 并将同一图像转换为 PNG 8 alpha 不起作用。
  • 这些都在 AS2 中工作
  • 标题之间没有区别

失败图像的标题

[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:17:28 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Tue, 06 Apr 2010 13:44:05 GMT
[4] => ETag: "3700054-11d6-a3983340"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 4566
[7] => Connection: close
[8] => Content-Type: image/png

工作图像的标题

[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:19:02 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Fri, 30 Oct 2009 18:38:08 GMT
[4] => ETag: "ba8057-65f2-5445c400"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 26098
[7] => Connection: close
[8] => Content-Type: image/png

任何关于进一步调查方向的想法或对几乎没有文档的令人困惑的问题的想法;非常热烈地欢迎。

编辑

现在看起来好像图像的 PHP 转换中的某些内容正在被轴操纵;我使用以下 PHP 来添加 alpha 图层:-

imagealphablending($image_p, false);
ImageSaveAlpha($image_p, true);
ImageFill($image_p, 0, 0, IMG_COLOR_TRANSPARENT); 

After whittling down of the options we've encountered a problem with PNG's and ActionScript 3 (AS3).

When loading a PNG 8 or PNG 32 with alpha transparancy we're getting the following error reported in Flash:-

"Error #2124: Loaded file is an unknown type"

Now, we're dealing with some legacy images, and it appears as though this problem isn't universal - some images believed to be 32bit alpha PNG are loading. BUT, some conclusions:-

  • converting one image that was 32 bit alpha (NOT WORKING IN AS3) to PNG 8 index transparency DID work.
  • And converting that same image to PNG 8 alpha DID NOT work.
  • These all worked in AS2
  • There is no difference between the headers

Headers of a Failing Image

[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:17:28 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Tue, 06 Apr 2010 13:44:05 GMT
[4] => ETag: "3700054-11d6-a3983340"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 4566
[7] => Connection: close
[8] => Content-Type: image/png

Headers of a Working Image

[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:19:02 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Fri, 30 Oct 2009 18:38:08 GMT
[4] => ETag: "ba8057-65f2-5445c400"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 26098
[7] => Connection: close
[8] => Content-Type: image/png

Any thoughts of a direction of further investigation or thoughts on a bewildering problem with little to no documentation; very warmly welcomed.

EDIT

Now it would appear as though something in the PHP conversion of the images is shafting; I use the following PHP to add alpha layers:-

imagealphablending($image_p, false);
ImageSaveAlpha($image_p, true);
ImageFill($image_p, 0, 0, IMG_COLOR_TRANSPARENT); 

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

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

发布评论

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

评论(1

独﹏钓一江月 2024-09-03 20:22:32

HTTP 标头实际上对 Flash 播放器影响不大。它通常会查看文件头,因此您应该检查这些是否正确。另外,如果您使用图形软件,打开它并再次以 32 位透明度导出,会发生什么情况。问题消失了吗?

最后但并非最不重要的一点是,您应该考虑到 Flash Player 并不支持所有 PNG 功能。人们通常遇到的一种情况是交错。会是这样吗?

HTTP headers actually matter only little to flash player. It usually looks at file headers, so you should look whether those are correct. Also, what happens if you take a graphics software, open it and export it again, with 32 bit transparency. Does the problem disappear?

Last but not least, you should consider Flash Player doesn't support all PNG features. The one which people usually run into is interlacing. could that be it?

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