Select to view content in your preferred language

map legend widget for 1.3

1087
4
06-21-2011 08:10 AM
DanielLewis
Emerging Contributor
I'm trying to implement Robert's rest legend widget for 1.3 (http://forums.esri.com/Thread.asp?c=158&f=2421&t=299116).  I have the web service working and it produces good xml output when tested from the server.  I've added all the mxml files to the src distribution and compiled.

In the webviewer, the livemapswidget shows the legend icon.  When I click on it, i see a broken link icon and when I click on that, window entitled "Legend" appears, with the same broken link icon at the top.  I never seen any "please wait, generating legend" displayed.  I believe I have followed the readme to the letter.

Thanks in advance
Tags (2)
0 Kudos
4 Replies
DanielLewis
Emerging Contributor
I figured out the widget issue and now I get "Please be patient..." forever, or sometimes it will show "no visible layers".
0 Kudos
DanielLewis
Emerging Contributor
It's getting through the function showStateLegend().  I added some "showmessage()" to track it's progress:

   private function showStateLegend(event:MouseEvent):void
   {
    WidgetEffects.flipWidget(this, viewStack, "selectedIndex", 2, 400);
    //This is where we determine if this is the first call to make
    //the legend or do we just need to update it
    if (legendRepeater.dataProvider != null){
     updateLegend();
    } else {
     showMessage("Please be patient while the Legend is generated...", true);
     var liveLayers:Array = getLayers(); 
     var url:String; 
     for (var i:int = 0; i < liveLayers.length;i++) {
      if (liveLayers is ArcGISDynamicMapServiceLayer) {
       requestCount++;           
       url = ArcGISDynamicMapServiceLayer(liveLayers).url.replace("rest/", "");
       // - debugging
       showMessage(url, true);
       showMessage(i.toString(), true);
       showMessage("opening webService...", true);

       webService.generateLegends.send(url, 96, 20, 20, ArcGISDynamicMapServiceLayer(liveLayers).id);
       showMessage("ended webService...", true);
       
      } else if (liveLayers is ArcGISTiledMapServiceLayer) {
       requestCount++;
       url = ArcGISTiledMapServiceLayer(liveLayers).url.replace("rest/", "");
       showMessage(url, true);
       showMessage(i.toString(), true);
       showMessage("opening webService for tiled...", true);
       webService.generateLegends.send(url, 96, 20, 20, ArcGISTiledMapServiceLayer(liveLayers).id);
       showMessage("ended webService for tiled...", true);

      }     
     }
     showMessage("got through the for loop...", true);        
    }
   }


It does display the "got through the for loop..." which is after the for loop.  It just spins the indicator.

It's never getting to the getLegend_result() function.

If I test the /restLegend/restLegend.asmx on the server, it is working.
0 Kudos
DanielLewis
Emerging Contributor
Can someone point me to what I might look at to figure out why the dynamic legend isn' working?  Upon initial load or after hitting refresh, it just spins saying to please wait.  If I pan the map or resize, it reports that "There are no visible layers, or map legend generation failed!", although I have at least 2 or more layers displayed at the time.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   Why are you still fooling with 1.x version of the viewer when esri is about to release Flex Viewer 2.4 this month?... You are one Major version and nearly 4 minor version behind. I really don't have time to attempt to support 1.x versions of my code any more. Best thing I can tell you is to navigate to the web service in your browser and  give it the requested value and see if the urls to the swatches are valid.
0 Kudos