I add ArcGISDynamicMapServiceLayer to map using following code. It's added successfully and shows the map as expected. When the map is loading, I want to mask the screen. I am doing it as per following code (see bold comments). Now, if map image is taking time to load then which event I can capture so, I can unmask in that event? I added map-image-export to the dynamiclayer but it never gets called from the api. I see from the fiddler that export image url is in progress but 'layer-add-result' gets executed. It seems if map image takes time to load, then API is firing export url explicitly and load the map in configured div. Does API sends status of map loading in any callback function?
//masking here
vDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(vURL, {
'opacity' : 1,
'imageParameters' : vImageParameters
});
vMap = new Map(vMapDiv, {
sliderOrientation: 'vertical',
infoWindow: vPopup,
autoResize: true,
logo: false
});
vDynamicMapServiceLayer.on('map-image-export', function() {
//unmask here
});
vMap.on('layer-add-result', function() {
//unmasking here
}, error);
vMap.addLayer(vDynamicMapServiceLayer);
Solved! Go to Solution.
The ArcGISDynamicMapServiceLayer does have a load event that you can listen for, which fires after layer properties for the layer are successfully populated. There are also update, update-start, and update-end events.
The ArcGISDynamicMapServiceLayer does have a load event that you can listen for, which fires after layer properties for the layer are successfully populated. There are also update, update-start, and update-end events.
Actually, I tried out update-end after posting the question and it worked for me. Thanks!