Hi John,I'm trying to reproduce the issue you are experiencing but in my test case (see below) OnUpdateStart and OnUpdateEnd fire for each layer that's listening for the event. In my testing both events fire when layers load and update themselves.You are correct, all the update events (onUpdate,onUpdateStart,onUpdateEnd) only fire for visible layers. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>Map loading image</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
<script type="text/javascript">
dojo.require("esri.map");
var dynamicMapServiceLayer;
function init() {
var map = new esri.Map("map");
//Takes a URL to a map in a map service.
var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
map.addLayer(tiledMapServiceLayer);
dojo.connect(tiledMapServiceLayer, "onUpdateEnd", UpdateEnd);
dojo.connect(tiledMapServiceLayer,"onUpdateStart",UpdateStart);
var statesLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer");
map.addLayer(statesLayer);
dojo.connect(statesLayer,"onUpdateEnd",UpdateEnd);
dojo.connect(statesLayer,"onUpdateStart",UpdateStart);
//Takes a URL to a non cached map service.
dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer");
dynamicMapServiceLayer.setOpacity(0.5);
dynamicMapServiceLayer.setVisibility(false);
map.addLayer(dynamicMapServiceLayer);
dojo.connect(dynamicMapServiceLayer, "onUpdateEnd", UpdateEnd);
dojo.connect(dynamicMapServiceLayer,"onUpdateStart", UpdateStart);
}
function UpdateStart(){
console.log(this.url + " Update Start");
}
function UpdateEnd(){
console.log(this.url + " Update End");
}
function setVisible(){
dynamicMapServiceLayer.setVisibility(!dynamicMapServiceLayer.visible);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<button onClick="setVisible();">Toggle Dynamic Layer Visibility</button>
<div id="map" style="position:relative; width:1024px; height:512px; border:1px solid #000;">
<img id="loadingImg" src="images/loading.gif" style="position:absolute; right:512px; top:256px; z-index:100;" />
</div>
</body>
</html>