flex-viewer让指定slid值对于的图层可见
//让指定slid值对于的图层可见 private function initOpLayers():void { if (configXML.hasOwnProperty("visiblelsids")) { for each(var lyro:Object in configData.opLayers) { map.getLayer(lyro.lyrid).visible=false; } var visiblelsids:XMLList = configXML.visiblelsids.visiblelsid; for each(var visiblelsid:XML in visiblelsids) { if(this.configData.services.lyrservices.hasOwnProperty(visiblelsid.@id)) { var lyrO:Object=this.configData.services.lyrservices[visiblelsid.@id]; var temlayer:Layer=map.getLayer(lyrO.lyrid); if(temlayer is TiledMapServiceLayer) { temlayer.visible=true; } else if(temlayer is ArcGISDynamicMapServiceLayer) { temlayer.visible=true; } } } } }
通过url让map中的图层可见
GisUtil.getInstance().showLayerByUrl(map,this.serviceurl);
protected function bordercontainer1_clickHandler(event:MouseEvent):void { var lyrO:Object=data.configData.services.lyrservices[data.lsid]; for each(var lyro:Object in (data.configData as ConfigData).basemaps) { if(lyro.lyrid==lyrO.lyrid) { data.map.getLayer(lyro.lyrid).visible=true; } else { data.map.getLayer(lyro.lyrid).visible=false; } } }