Can't run my game using tiled maps

Can't run my game using tiled maps
0.0 0


Hello guys,

I’m having trouble with tiled maps made by Tiled. Every time that I tried to load a map, this error occur:

Uncaught TypeError: Cannot call method 'getAttribute' of undefined (02:19:38:666 | error, javascript) at (public_html/lib/Cocos2d-html5-v2.0.min.js:817:527) at (public_html/lib/Cocos2d-html5-v2.0.min.js:814:492) at cc.TMXMapInfo.create (public_html/lib/Cocos2d-html5-v2.0.min.js:824:429) at (public_html/lib/Cocos2d-html5-v2.0.min.js:804:305) at cc.TMXTiledMap.create (public_html/lib/Cocos2d-html5-v2.0.min.js:808:71) at cc.Layer.extend.initBackground (public_html/theCrushers.js:19:36) at cc.Layer.extend.init (public_html/theCrushers.js:14:14) at cc.Scene.extend.onEnter (public_html/theCrushers.js:29:19) at (public_html/lib/Cocos2d-html5-v2.0.min.js:2:351) at (public_html/lib/Cocos2d-html5-v2.0.min.js:705:463) at (public_html/lib/Cocos2d-html5-v2.0.min.js:697:396) at (public_html/lib/Cocos2d-html5-v2.0.min.js:715:353) at a (public_html/lib/Cocos2d-html5-v2.0.min.js:758:433)

The game didn’t work after this. This is my test code when I try to load a map:

`var sceneGame = cc.Layer.extend({
init:function() {
//var layerBg = cc.LayerColor.create(new cc.Color4B(0, 0, 0, 255), 800, 600);
//layerBg.setPosition(new cc.p(0, 0));

    //var player = new Character();
    //player.initWithTexture(cc.TextureCache.getInstance().addImage("img/cars/cars01.png"), cc.rect(0, 128, 129, 64));
    //player.setPosition(new cc.p(400, 300));


    return true;
initBackground:function() {
    this._map = cc.TMXTiledMap.create("maps/city01.tmx", -1);


var sceneManager = cc.Scene.extend({
onEnter:function() {

    var currScene = new sceneGame();


What I have did wrong? Anyone have the same problem? How can I solve this?

I’ll appreciate all your answers! Sorry about my bad/weird english, I’m not native!

Best regards,


you should reload the resource.


jk la wrote:

you should reload the resource.



use this


More like this

cc.LoaderScene.preload(resourcelist, function () {
}, this);