I know how to implement a "Loading" message within a widget to inform the user the widget is processing.
Is there a way to have a similar "Loading" message after a layer is checked in the TOC and before the layer loads?
There's a loading widget in the gallery that shows the progress bar when the basemap is being rendered and when layers are being rendered.
<widget horizontalcenter="0" verticalcenter="0" url="widgets/MapProgressBar/MapProgressBarWidget.swf"/>
protected function layerUpdateEndHandler(event:LayerEvent):void { var lyr:Layer = event.layer; //once a layer finished its update,remove the layer from layer collection if (layerColl.contains(lyr)){ layerColl.removeItemAt(layerColl.getItemIndex(lyr)); } //all layers finished their loading and rendering,hide the progress pb.visible = !layerColl.length == 0; trace(layerColl.length); }The protected function is supposed to iterate with each layer in the layerColl, but for some reason (since the layer in question is no longer in the refreshed map?), the layerUpdateEndHandler does not run to remove that layer, thus the condition pb.visible = !layerColl.length ==0 is still in effect, since layerColl still contains the parcels layer. In other words, if a layer is removed as the result of an extent change, it does not seem to activate the mapLayerRemoveHandler, since it is not registered by the MapEvent.LAYER_REMOVE event???
protected function layerUpdateStartHandler(event:LayerEvent):void
{
//once a layer starts to update,show the progressbar
pb.visible = true;
var lyr:Layer = event.layer;
//If a ArcGISTiledMapServiceLayer has Display Levels defined and the map has custom
//LODs defined than it takes this extra work to determine if the layer is actually
//drawing at this LOD and if not then just return and do not add this layer to the
//layerColl
var Lod:LOD = map.lods[map.level];
if (lyr is ArcGISTiledMapServiceLayer){
var tLyr:ArcGISTiledMapServiceLayer = lyr as ArcGISTiledMapServiceLayer;
if(tLyr.displayLevels){
var pLodFound:Boolean;
for each(var tLod:LOD in layerTileInfoCache[tLyr]){
if (tLod == Lod) pLodFound = true;
}
if(!pLodFound) return;
}
}
if(!lyr.isInScaleRange) return; //Which means that the layer never gets added to the collection
//add the layer to layer collection
if (!layerColl.contains(lyr)){
layerColl.addItem(lyr);
}
}