I'm attempting to convert the example that Kelly wrote to add the basemap gallery basemaps to the map in a dropdown button into AMD. I'm running into a problem with getting the base maps added to the button. In this function, the ForEach loop fires, but the children aren't added. I've created a fiddler with the new code and original code commented out. function createBasemapGallery() { var basemapGallery = new BasemapGallery({ showArcGISBasemaps: true, map: map }); connect.connect(basemapGallery, 'onLoad', function () { array.forEach(basemapGallery.basemaps, function (basemap) dom.byId('basemapMenu').addChild(new dijit.MenuItem({ label: basemap.title, onClick: lang.hitch(this, function(){ this.basemapGallery.select(basemap.id); }) })); }); }); }