src/level/tiled/TMXTiledMap.js
function (container, flatten) {
            var _sort = container.autoSort;
            var _depth = container.autoDepth;

            // disable auto-sort and auto-depth
            container.autoSort = false;
            container.autoDepth = false;

            // add all layers instances
            this.getLayers().forEach(function (layer) {
                container.addChild(layer);
            });

            // add all Object instances
            this.getObjects(flatten).forEach(function (object) {
                container.addChild(object);
            });

            //  set back auto-sort and auto-depth
            container.autoSort = _sort;
            container.autoDepth = _depth;

            // force a sort
            container.sort(true);
        }
function (container, flatten) {
            var _sort = container.autoSort;
            var _depth = container.autoDepth;

            // disable auto-sort and auto-depth
            container.autoSort = false;
            container.autoDepth = false;

            // add all layers instances
            this.getLayers().forEach(function (layer) {
                container.addChild(layer);
            });

            // add all Object instances
            this.getObjects(flatten).forEach(function (object) {
                container.addChild(object);
            });

            //  set back auto-sort and auto-depth
            container.autoSort = _sort;
            container.autoDepth = _depth;

            // force a sort
            container.sort(true);
        }
function ( container , flatten ) { var _sort = container . autoSort ; var _depth = container . autoDepth ; // disable auto-sort and auto-depth container . autoSort = false ; container . autoDepth = false ; // add all layers instances this . getLayers ( ) . forEach ( function ( layer ) { container . addChild ( layer ) ; } ) ; // add all Object instances this . getObjects ( flatten ) . forEach ( function ( object ) { container . addChild ( object ) ; } ) ; //  set back auto-sort and auto-depth container . autoSort = _sort ; container . autoDepth = _depth ; // force a sort container . sort ( true ) ; }
add all the map layers and objects to the given container
@name me.TMXTileMap#addTo
@public
@function
@param {me.Container} target container
@param {boolean} flatten if true, flatten all objects into the given container
@example
// create a new level object based on the TMX JSON object
var level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
// add the level to the game world container
level.addTo(me.game.world, true);
add all the map layers and objects to the given container