I have a map service with several group layers. I am trying to control the visibility of these layers programmatically by adding or removing them from the visibleLayers arrayCollection. It works great with stand alone layers, but if there are subLayers involved I get an unexpected result.
At the very least all the layers in the groupLayer are visible in the map even though I have explicitly removed certain layers from the visibleLayers AC. Remarkably, the TOC widget correctly shows the visibility, only the map incorrectly shows visibility, which means they are not in sync.
I am looking for a way to refresh the map or an event to dispatch so that the map will match the TOC widget and correctly display visible layers.
Your help is appreciated.
-Dan