I’m trying to load a TMX file dynamically.
I followed the first response on this post here.
This is what my code looks like:
var theMap = new cc.TiledMap();
cc.loader.loadRes("testlevel1", cc.TiledMapAsset, function (err, mapAsset) {
cc.log(mapAsset);
cc.log(theMap);
theMap.tmxAsset = mapAsset;
});
I’m getting an error that looks like this.
Any ideas as to what is producing this error? I know when I comment or remove this line of code theMap.tmxAsset = mapAsset;
The error goes away, but I need to assign the TiledMapAsset to the TiledMap so I can work with it!