Select to view content in your preferred language

Dynamic Legend Widget 3.0 does not display tiled layer legend -- Calling Robert S.

709
5
09-26-2012 06:38 AM
MarcWeinshenker1
Regular Contributor
Robert,

In the process of converting from the 2.5 version of the Dynamic Legend Widget to 3.0 for use in the 3.0 Flex Viewer, I found that my tiled service was no longer in the legend.  After troubleshooting this, I found a fix that I would like to submit for consideration.

In the module LegendItemRenderer.mxml, in private function itemrenderer_dataChangeHandler(event:FlexEvent):void, I changed the commented line as shown here to include the lId parameter where there was no parameter.
if (layer is ArcGISDynamicMapServiceLayer){
 layer.addEventListener(FlexEvent.SHOW,updateVisibilty);
 layer.addEventListener(FlexEvent.HIDE,updateVisibilty);
 if(!ArcGISDynamicMapServiceLayer(layer).visibleLayers){
  visArr = buildVisibleLayers(ArcGISDynamicMapServiceLayer(layer).layerInfos);
 }else{
  visArr = ArcGISDynamicMapServiceLayer(layer).visibleLayers as ArrayCollection;
 }
 ChangeWatcher.watch(ArcGISDynamicMapServiceLayer(layer), "visibleLayers", updateVisibilty);
}else if (layer is FeatureLayer){
 layer.addEventListener(FlexEvent.SHOW,updateVisibilty);
 layer.addEventListener(FlexEvent.HIDE,updateVisibilty);
 visArr = new ArrayCollection([lId]);
}else{
 visArr = new ArrayCollection([lId]); // MDW change [] to [lId]
}


Robert -- do you agree with this? 

Thanks,
Marc
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Marc,

   I has been a while since I have looked at the dynamic legend code... What you are proposing sounds logical. I will take a look and update the code if I don't find any issues. Thanks for sharing.
0 Kudos
RhettZufelt
MVP Notable Contributor
Hi Robert,

Didn't want to start a new thread, and it doesn't give me the option to PM you.

anyway, I noticed that your live preview site for the dynamic legend widget is trying to load a Symbols mapservice that doesn't exist anymore and is throwing an error.

R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

  Thanks for the heads up.
0 Kudos
ChristopherDamon
Deactivated User
Marc,

Applying the mod you suggested did get tiled services to show in the Flexviewer 3.0 dynamic legend widget, but the legend doesn't update itself when additional layers are turned on and off.  Are you seeing this same behavior with your viewer?
0 Kudos
MarcWeinshenker1
Regular Contributor
Mine is working properly. 

Marc

Marc,

Applying the mod you suggested did get tiled services to show in the Flexviewer 3.0 dynamic legend widget, but the legend doesn't update itself when additional layers are turned on and off.  Are you seeing this same behavior with your viewer?
0 Kudos