forthungm

Same basemap for all scripts

Discussion created by forthungm on Mar 5, 2014
Latest reply on Apr 17, 2014 by JGravois-esristaff
I have multiple scripts that call for a basemap and I end up having a lot of basemaps in my application.  But if I take away a line of code  such as:
function init() {
        var startExtent = new esri.geometry.Extent(-83.5528, 31.7627, -77.3874, 35.5635, new esri.SpatialReference({wkid:4326}) );
   map = new esri.Map("mapDiv", { extent: startExtent });
        var streetMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");
   map.addLayer(streetMap);

Or:
map = new esri.Map("map",{
         basemap:"streets",
            center:[-81.045,33.998],
            zoom:7,
            sliderStyle:"small"
      });    

Then the script doesn't work.  But if I leave them in, then I have multiple maps in my application.  I think what I need to know is how do I get a basemap and keep it for use in for all the other scripts?   

Thanks.

Outcomes