0

I'm trying to display an image using JS and EaselJS.

I'm getting the error Uncaught TypeError: Object #<HTMLImageElement> has no method 'isVisible'

Here are my code snippets...

        function init() {                               
            canvas = document.getElementById("testCanvas"); 
            start();
        }

        function start() {
            //Create new stage and point it at Canvas
            stage = new createjs.Stage("demoCanvas");

            myImg = new Image();
            myImg.src = "./Images/SnakeHead.png";

Any thoughts why?

Thanks!

4

1 回答 1

0

从这个页面

当您向舞台添加不是显示对象的内容时,通常会发生此错误。在您使用的代码中

Icon.prototype = new Container()

您是否覆盖了 createjs 命名空间?如果没有,代码应该是

Icon.prototype = new createjs.Container();

如果这是问题所在,那么您没有正确扩展 Container,这可以解释错误。

于 2013-07-25T19:38:32.363 回答