Thanks Ivan,Yes, I have all my actual "map layers" in the mxd categorized within group layers. I'll look into your solution ASAP.-r
function showHideLayers(isSubLayerVisible:Boolean, serviceGroups:Array, layer:Layer, leafLayerLegendInfo:LayerLegendInfo, numLeaf:Number):void { var i:int; if (!isSubLayerVisible) { count++; } if (count == numLeaf) // all the layers with legends are not visible { for (i = 0; i < serviceGroups.length; i++) { serviceGroups.includeInLayout = serviceGroups.visible = false; } } else { for (i = 0; i < serviceGroups.length; i++) { serviceGroups.visible = serviceGroups.includeInLayout = true; for (var e:int = 0; e < serviceGroups.numElements; e++) { if (serviceGroups.getElementAt(e) is Label && Label(serviceGroups.getElementAt(e)).name == String(leafLayerLegendInfo.layerId)) { if (isSubLayerVisible) { Label(serviceGroups.getElementAt(e)).visible = Label(serviceGroups.getElementAt(e)).includeInLayout = true; if (!subLayerInScaleRange(leafLayerLegendInfo)) { if (hostComponent.respectCurrentMapScale) { Label(serviceGroups.getElementAt(e)).visible = Label(serviceGroups.getElementAt(e)).includeInLayout = false; } else { Label(serviceGroups.getElementAt(e)).alpha = 0.5; } } } else { Label(serviceGroups.getElementAt(e)).visible = Label(serviceGroups.getElementAt(e)).includeInLayout = false; } } if (serviceGroups.getElementAt(e) is DataGroup && DataGroup(serviceGroups.getElementAt(e)).name == String(leafLayerLegendInfo.layerId)) { if (isSubLayerVisible) { DataGroup(serviceGroups.getElementAt(e)).visible = DataGroup(serviceGroups.getElementAt(e)).includeInLayout = true; if (!subLayerInScaleRange(leafLayerLegendInfo)) { if (hostComponent.respectCurrentMapScale) { DataGroup(serviceGroups.getElementAt(e)).visible = DataGroup(serviceGroups.getElementAt(e)).includeInLayout = false; } else { DataGroup(serviceGroups.getElementAt(e)).alpha = 0.5; } } } else { DataGroup(serviceGroups.getElementAt(e)).visible = DataGroup(serviceGroups.getElementAt(e)).includeInLayout = false; } } // exclude Spacer if sublayer is not visible if (serviceGroups.getElementAt(e) is mx.controls.Spacer) { if (isSubLayerVisible) { mx.controls.Spacer(serviceGroups.getElementAt(e)).visible = mx.controls.Spacer(serviceGroups.getElementAt(e)).includeInLayout = true; if (!subLayerInScaleRange(leafLayerLegendInfo)) { if (hostComponent.respectCurrentMapScale) { mx.controls.Spacer(serviceGroups.getElementAt(e)).visible = mx.controls.Spacer(serviceGroups.getElementAt(e)).includeInLayout = false; } } } else { mx.controls.Spacer(serviceGroups.getElementAt(e)).visible = mx.controls.Spacer(serviceGroups.getElementAt(e)).includeInLayout = false; } } } } } isLegendShown(); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.