Unable to use tmx files exported with TIled (v 1.0.3)

I’m trying to create a new tilemap using Tiled. The xml file of the generated map doesn’t contain the tag and cocos throws this error:

TypeError: Cannot read property ‘getAttribute’ of undefined
at cc.TMXMapInfo.parseXMLString (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTMXXMLParser.js:354:46)
at cc.TMXMapInfo.initWithXML (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTMXXMLParser.js:280:29)
at new cc.TMXMapInfo (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTMXXMLParser.js:148:18)
at cc_TiledMap._applyFile (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTiledMap.js:169:35)
at cc_TiledMap.set (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTiledMap.js:91:34)
at cc_TiledMap.a.set [as tmxAsset] (C:\CocosCreator_2.1.3\resources\app.asar\editor\page\scene-utils\lib\asset-watcher.js:1:973)
at cc_TiledMapAsset.cc.Class.createNode (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\tilemap\CCTiledMapAsset.js:32:35)
at cc.AssetLibrary.loadAsset (C:\CocosCreator_2.1.3\resources\app.asar\editor\page\scene-utils\utils\node.js:1:5038)
at CCLoader. (C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\core\platform\CCAssetLibrary.js:65:25)
at C:\CocosCreator_2.1.3\resources\engine\bin.cache\dev\cocos2d\core\load-pipeline\CCLoader.js:141:46

If I try to edit an already existing tilemap (From cocos creator example project) I’m able to use it in my project.

I tried adding the image tag forcefully, cocos creator stopped showing the error and map gets added to the node tree but it’s blank and shows nothing in the scene.

It’s solved now.
There was an option “Embed in map” while importing a new tilset, I enabled that option and now it works.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.