【问题标题】:Exception when using canvas (0x80040111 NS_ERROR_NOT_AVAILABLE)使用画布时出现异常(0x80040111 NS_ERROR_NOT_AVAILABLE)
【发布时间】:2011-10-06 14:21:17
【问题描述】:

我在编写 JavaScript 绘图工具时遇到了一些麻烦。这是一个单元测试,将来将用作我正在从事的更大项目的组件。它在画布中运行,但是当我尝试运行它时,我收到以下错误消息:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMCanvasRenderingContext2D.drawImage]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: http://rasmvillage/canvasapp/js/lib.js :: <TOP_LEVEL> :: line 52"  data: no]

我正在使用 jquery 库

HTML 没有什么特别之处。只是一个 div#container,里面有一个 canvas#imageID 和 canvas#boardID。有人可以帮我找出问题所在吗?谢谢。

【问题讨论】:

标签: javascript canvas


【解决方案1】:

canvas drawImage doesn't draw images the first time 所示,请确保在图像onload 触发之前不要对图像进行操作。更多关于 Image onload for static images 的建议,包括一个可能有帮助的 jQuery 插件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-14
    • 2015-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    • 2015-02-05
    相关资源
    最近更新 更多