【问题标题】:Which package do I need to import to use JPGEncoder in flash?我需要导入哪个包才能在 Flash 中使用 JPGEncoder?
【发布时间】:2010-07-02 16:55:23
【问题描述】:
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(bmpData);

以上是报错:

Type was not found or was not a compile-time constant: JPGEncoder.
Call to a possibly undefined method JPGEncoder.

【问题讨论】:

  • @phwd 已经回答了您的问题,但是当您需要进一步说明时,您可能会对这篇博文感兴趣:henryjones.us/articles/using-the-as3-jpeg-encoder
  • @nikc,差不多了,但我真的是 flash 新手,当我尝试导入该包时似乎缺少某些东西......

标签: flash package


【解决方案1】:

你在说什么

com.adobe.images.JPGEncoder; ?

如果是这样,这是来自ActionScript 3 Core Library 中的核心类。

编辑:我所知道的唯一其他可能会预先打包的是

mx.graphics.codec.JPEGEncoder

不确定它如何匹配 as3core 库

【讨论】:

  • 谢谢!这次我得到:Definition com.adobe.images:JPGEncoder could not be found.核心类怎么包含?
  • 你需要下载它code.google.com/p/as3corelib我把上面的链接贴在这里了。
  • 仍然无法访问com.adobe.images::JPGEncoder/encode() :(它通过编译但在运行时失败。
  • @nikc,我只是将com 目录放在我的.fla 所在的同一目录下。应该可以,对吧?
  • @ieplugin 我尝试了@nikc 博客链接,并在使用 Flash CS3 发布后在我的本地主机上运行我遇到了同样的错误,并将我的 com 文件夹与我的 fla 文件放在同一级别。您能否列出您的 Flash IDE 和 Flash Player 版本,如果可能的话,请尝试浏览 @nikc 提供的博客示例,也许您忽略了一些东西。您的代码是在文档类还是框架中?失败是什么?运行它调试并更新问题?抱歉有这些问题。只是想定义你的问题:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-01-20
  • 1970-01-01
  • 2017-11-04
  • 1970-01-01
  • 2021-09-29
  • 2023-03-06
  • 1970-01-01
相关资源
最近更新 更多