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); } }
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); }
<widget horizontalcenter="0" verticalcenter="0" url="widgets/MapProgressBar/MapProgressBarWidget.swf"/>
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.
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?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.