private function basemapButtonBar_changeHandler(event:IndexChangeEvent):void { var layers:ArrayCollection = map.layers as ArrayCollection; basemapsButtonBar.fader.value = event.newIndex + 1; for (var x:int = 0; x < basemapList.length; x++){ var basemapLabel:String = basemapList.getItemAt(x).label; for each (var layer:Layer in layers){ if(basemapList.getItemAt(event.newIndex).label != basemapLabel) if(layer.id == basemapLabel) layer.visible = false; if(layer.id == basemapLabel) layer.alpha = 1; } } if(basemapList.getItemAt(event.newIndex).forcescaleonswitch && map.scale < basemapList.getItemAt(event.newIndex).forcescaleonswitch){ map.scale = basemapList.getItemAt(event.newIndex).forcescaleonswitch; /* if(basemapList.getItemAt(basemapSelectionComponent.selectedIndex).label == "myspecialbasemap"){ map.centerAt(new MapPoint(x,y, map.spatialReference)); } */ if(basemapList.getItemAt(basemapSelectionComponent.selectedIndex).label == "Aerial (36,111 and below)" && map.scale > 36111.909643) map.scale = 36111.909643; } AppEvent.dispatch(AppEvent.BASEMAP_SWITCH, basemapList.getItemAt(event.newIndex).id); }
<layer label="Aerial (36,111 and below)" type="tiled" visible="false" maxscale="4513.9887049999998" minscale="36111.909643" forcescaleonswitch="4513.9887049999998" autoswitchtoscale="36111.909643" icon="assets/images/aerial.png" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/> <layer label="Topo (72,223 and above)" type="tiled" visible="true" maxscale="72223.819286" forcescaleonswitch="72223.819286" autoswitchtoscale="72223.819286" icon="assets/images/topo.png" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.