From fa5eda20cdf76ee805021c831da93369c641d60e Mon Sep 17 00:00:00 2001 From: Sarthak Datt Date: Tue, 26 Feb 2013 14:56:13 -0800 Subject: [PATCH] _dynamicServiceLayerInfos is populated before setting visible layers --- .../viewer/components/toc/tocClasses/TocMapLayerItem.as | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/com/esri/viewer/components/toc/tocClasses/TocMapLayerItem.as b/src/com/esri/viewer/components/toc/tocClasses/TocMapLayerItem.as index 591a777..ded886b 100644 --- a/src/com/esri/viewer/components/toc/tocClasses/TocMapLayerItem.as +++ b/src/com/esri/viewer/components/toc/tocClasses/TocMapLayerItem.as @@ -423,15 +423,14 @@ public class TocMapLayerItem extends TocItem else if (layer is ArcGISDynamicMapServiceLayer) { var arcGISDynamicMapServiceLayer:ArcGISDynamicMapServiceLayer = ArcGISDynamicMapServiceLayer(layer); + _dynamicMapServiceLayerInfos = arcGISDynamicMapServiceLayer.dynamicLayerInfos ? arcGISDynamicMapServiceLayer.dynamicLayerInfos : arcGISDynamicMapServiceLayer.layerInfos; if (!arcGISDynamicMapServiceLayer.visibleLayers) { var visLayers:Array = getActualVisibleLayers(MapServiceUtil.getVisibleSubLayers(_dynamicMapServiceLayerInfos), _dynamicMapServiceLayerInfos); arcGISDynamicMapServiceLayer.visibleLayers = new ArrayCollection(visLayers); } - arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler); - - _visibleLayersChangeWatcher = ChangeWatcher.watch(arcGISDynamicMapServiceLayer, "visibleLayers", visibleLayersChange); - _dynamicMapServiceLayerInfos = arcGISDynamicMapServiceLayer.dynamicLayerInfos ? arcGISDynamicMapServiceLayer.dynamicLayerInfos : arcGISDynamicMapServiceLayer.layerInfos; + arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler); + _visibleLayersChangeWatcher = ChangeWatcher.watch(arcGISDynamicMapServiceLayer, "visibleLayers", visibleLayersChange); if (_isVisibleLayersSet) { layerInfos = [];