Hi, I want to make TiledMaps dynamically from code, creating and xml and assigning it through the tmxXmlStr
property, similar to using var tileMap = new cc.TMXTiledMap(xml, "res/mytilesets");
in Cocos2d-x JavaScript. I have the TiledMap created in the editor and showed on the screen. After running the following code for changing the data encoding:
var xml = '<?xml version="1.0" encoding="UTF-8"?><map version="1.0" orientation="orthogonal" width="16" height="16" tilewidth="32" tileheight="32"><tileset firstgid="1" name="mytileset" tilewidth="32" tileheight="32"><image source="mytileset.png"/></tileset><layer name="Layer 0" width="4" height="4"><data encoding="csv">1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,1</data></layer></map>';
find('Canvas/TiledMap').getComponent(TiledMap).tmxAsset.tmxXmlStr = xml;
console.info(find('Canvas/TiledMap').getComponent(TiledMap).tmxAsset.tmxXmlStr);
The property has been modified but no changes are shown on screen tilemap.
Any idea?. Thanks.