当我在画布上,并发送了创建阶段,我得到这个字符串错误:方法createjs.Stage返回与easeljs错误
Uncaught TypeError: Cannot call method 'addEventListener' of undefined.
我的初始化函数:
function init() {
canvas = document.getElementById("testCanvas");
stage = new createjs.Stage(canvas);
screen_width = canvas.width;
screen_height = canvas.height;
contentManager = new ContentManager();
contentManager.SetDownloadCompleted(startGame);
contentManager.StartDownload();
}
块的代码给出的错误是:
p.enableDOMEvents = function(enable) {
if (enable == null) { enable = true; }
var n, o, ls = this._eventListeners;
if (!enable && ls) {
for (n in ls) {
o = ls[n];
o.t.removeEventListener(n, o.f);
}
this._eventListeners = null;
} else if (enable && !ls) {
var t = window.addEventListener ? window : document;
var _this = this;
ls = this._eventListeners = {};
ls["mouseup"] = {t:t, f:function(e) { _this._handleMouseUp(e)} };
ls["mousemove"] = {t:t, f:function(e) { _this._handleMouseMove(e)} };
ls["dblclick"] = {t:t, f:function(e) { _this._handleDoubleClick(e)} };
t = this.canvas;
if (t) { ls["mousedown"] = {t:t, f:function(e) { _this._handleMouseDown(e)} }; }
for (n in ls) {
o = ls[n];
o.t.addEventListener(n, o.f);
}
}
特别是这个块:
for (n in ls) {
o = ls[n];
o.t.addEventListener(n, o.f);
}
当'n'的值是BitmapAnimation_initialize
时,会给出错误。我发现此代码到Stage.js中,该文件伴随着easeljs的rar v0.6.0