Select to view content in your preferred language

Legend in reverse order since 2.4 upgrade

750
3
10-10-2011 12:40 PM
TammyBearly
Deactivated User
I recently upgraded to the 2.4 API.  Now my legend displays the polygons first, then the points.  Before I upgraded it was the other way around.  Why is this happening?
Tags (2)
0 Kudos
3 Replies
TammyBearly
Deactivated User
Here is the code I am using:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:esri="http://www.esri.com/2008/ags"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
      >
<fx:Script>
  <![CDATA[
  
   import mx.collections.ArrayCollection;
   private function loadLayer_Handler():void{
    legendLayer.visibleLayers = new ArrayCollection([13,14,77,78,88,89]);
   }
  ]]>
</fx:Script>
<s:layout>
  <s:HorizontalLayout gap="0"/>
</s:layout>
<esri:Legend id="myLegend" width="100%"
     respectCurrentMapScale="true"
     layers="{[ legendLayer ]}"
     map="{myMap}"
     height="100%"/>
<esri:Map id="myMap">
  <esri:extent>  
   <esri:Extent xmin="-12350000" ymin="4250000" xmax="-11150000" ymax="5250000">
    <esri:SpatialReference wkid="102100"/>
   </esri:Extent>
  </esri:extent>
  <esri:ArcGISTiledMapServiceLayer id="baseLayer" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
  <esri:ArcGISDynamicMapServiceLayer id="legendLayer" name="Hunter Reference" load="loadLayer_Handler()"
             url="http://ndis-flex.nrel.colostate.edu/ArcGIS/rest/services/CHA_HunterBase_Map/MapServer"/>
</esri:Map>

</s:Application>

When I compile with agslib-2.2-2010-12-08.swc it is in the correct order.  See image map2.2.gif.

But when I compile with agslib-2.4-2011-7-25.swc it is reversed.  See image map2.4.gif.

Tammy
0 Kudos
TammyBearly
Deactivated User
Is anyone else having this trouble?
0 Kudos
TammyBearly
Deactivated User
I found out that if I do not set the layerVisibility it works fine.  It does not display the legend in reverse order.

I tried setting the layerVisibility in mxml and actionscript and in each case it reverses the legend.

What changed in 2.4 to cause this?  It does not happen in 2.2.

I am using layerVisibility to turn on/off layers as the user zooms in to display different point symbols.  Is there another way to do this?

Any help is appreciated!
0 Kudos