chrome 33.0
cocos2d-html 2.1.5
Uncaught TypeError: Object [object Object] has no method ‘getCamera’
根据官网跑酷的例子写的代码,搞不懂为什么会这样。
用firefox运行不报错,但是感觉并不是预期的运行结果。
Hi, @auv1107
Can you post your detailed code which triggered the issue ? Otherwise it’s hard to tell what’s wrong.
Huabin
var BackgroundLayer = cc.Layer.extend({
...
update: function(dt) {
var animationLayer = this.getParent().getChildByTag(TagOfLayer.Animation);
var eyeX = animationLayer.getEyeX();
this.checkAndReload(eyeX);
var camera = this.getCamera();
var eyeZ = cc.Camera.getZEye();
camera.setEye(eyeX, 0, eyeZ);
camera.setCenter(eyeX, 0, 0);
},
});
can these help?
I change cocos from v2.1.5 to v2.2.2, then no errors occured. and the app seems works well.
the docs on cocos2d-x.org is for 2.2.2… choose a suitable version is really so essensial!