var map, baseLyr; require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/domReady!"], function(Map,ArcGISTiledMapServiceLayer) { // create map map = new Map("mapDiv", { center: [-117.719, 34.100], zoom: 14 }); // add basemap with 50% opacity baseLyr = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", {opacity:0.5}); map.addLayer(baseLyr); });
var lyrOpac = map.getLayer(map.getLayer[0]); //assuming your the layer is at 0 index. lyrOpac.setOpacity(0.5);