I managed to hack out some progress on my issue. The LayerListWidget and MapSwitchWidget will "partially" update after the dropdrownlist item selection but only to a point. I need to change the updateCB function to act just like the visiblelayer arraycollections in only turning on those layers in the collection and by default turning the layers not in the array collection off.
It seems the visiblelayer array collections would need to go over to the updateCB function. Then those layers in the array collections would be turned on and the rest turn off.
Any help on this would be appreciated.
Thank you.
-----------------------------------------
I updated the code for the TocItem.as file:
-----------------------------------------
public function TocItem(parentItem:TocItem = null)
{
_parent = parentItem;
//****Updated to ViewContainer***SiteContainer.addEventListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCB);
//****ViewContainer Deprecated***ViewerContainer.addEventListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCB);
AppEvent.addListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCB);
}
private function updateCB(event:AppEvent):void
{
if(this is TocLayerInfoItem)
{
var tli:TocLayerInfoItem = this as TocLayerInfoItem;
if(tli.layerInfo.name == event.data){
setVisible(_visible ? false : true);
}
}
}
----------------------------------------
I updated the HeaderControllerWidget.mxml
----------------------------------------
protected function mapScheme_changeHandler(event:IndexChangeEvent):void
{
{
if (mapScheme.selectedIndex == 0)
///Parcels, Sales, Foreclosures - dropdownlist
{
var servA:ArcGISDynamicMapServiceLayer = map.getLayer("TaxParcel") as ArcGISDynamicMapServiceLayer;
var servB:ArcGISDynamicMapServiceLayer = map.getLayer("Assessment") as ArcGISDynamicMapServiceLayer;
servA.visibleLayers = new ArrayCollection([0]);
servB.visibleLayers = new ArrayCollection([1,2]);
//****Deprecated********ViewerContainer.dispatchEvent(new AppEvent(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "TaxParcelPublishing"));
AppEvent.dispatch(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "TaxParcelPublishing");
AppEvent.dispatch(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "Recorded Tax Parcel Sales");
AppEvent.dispatch(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "Sheriff's Deeds");
}
//Assessment Appeals - dropdown
else if (mapScheme.selectedIndex == 1)
{
var servA:ArcGISDynamicMapServiceLayer = map.getLayer("TaxParcel") as ArcGISDynamicMapServiceLayer;
var servB:ArcGISDynamicMapServiceLayer = map.getLayer("Assessment") as ArcGISDynamicMapServiceLayer;
servA.visibleLayers = new ArrayCollection();
servB.visibleLayers = new ArrayCollection([3]);
AppEvent.dispatch(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "Assessment Appeals");
}
}
}