<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JSON to LayerLegendInfo in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520300#M11808</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dasa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your feedback on this, I did come accross the ILegendSupport interface after I posted this but have only just had time to look into it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I have written some code which should work however, I seem to be getting a rather unexpected result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that I'm using ArcGIS Server 10.0 Service Pack 1 (Microsoft .Net Framework Edition) with ArcGIS API for Flex version 2.2.2010-12-08 on a secure network (i.e. no internet access).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code, which is invoked once the ArcGISDynamicMapServiceLayer has completed initialisation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
protected function referenceDataLayerInitComplete(event:FlexEvent):void
{
 // Note that referenceDataMapLayer is an ArcGISDynamicMapServiceLayer from 10.0 SP1
 var token:AsyncToken = referenceDataMapLayer.getLegendInfos(null);
 var responder:mx.rpc.Responder = new mx.rpc.Responder(getLegendResult, getLegendFault);
 token.addResponder(responder);
}

public function getLegendResult(obj:Object):void
{
 trace("We have a result");
}

public function getLegendFault(obj:Object):void
{
 trace("We have an error");
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everytime I invoke the code I get a HTTP error because it appears as though the getLegendsInfos is always sending the request to &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/sharing/tools/legend" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/sharing/tools/legend&lt;/A&gt;&lt;SPAN&gt; - which fails because there is no internet connection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have checked the service info returned for the ArcGISDynamicMapServiceLayer and it is returning the correct version of 10.01 so I would expect it to access the local rest endpoint for the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have i done something wrong or is this a bug.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:41:17 GMT</pubDate>
    <dc:creator>AndrewHaigh</dc:creator>
    <dc:date>2021-12-11T22:41:17Z</dc:date>
    <item>
      <title>JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520298#M11806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm wondering what the best way is to convert the results of the ArcGIS Server 10 SP1 Legend request into an array of LayerLegendInfo for an ArcGISDynamicMapServiceLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a smart way I can do it or is it just a mater of iterating through the object returned by the HTTP Service?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did try and specify a format of AMF onto the legend request but it comes back as not supported.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 12:53:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520298#M11806</guid>
      <dc:creator>AndrewHaigh</dc:creator>
      <dc:date>2010-12-16T12:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520299#M11807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can call getLegendInfos() on the 3 layers that implement the ILegendSupport interface and your responder will get an Array of LayerLegendInfo instances:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ILegendSupport.html"&gt;http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ILegendSupport.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 20:20:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520299#M11807</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-12-16T20:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520300#M11808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dasa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your feedback on this, I did come accross the ILegendSupport interface after I posted this but have only just had time to look into it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I have written some code which should work however, I seem to be getting a rather unexpected result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that I'm using ArcGIS Server 10.0 Service Pack 1 (Microsoft .Net Framework Edition) with ArcGIS API for Flex version 2.2.2010-12-08 on a secure network (i.e. no internet access).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code, which is invoked once the ArcGISDynamicMapServiceLayer has completed initialisation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
protected function referenceDataLayerInitComplete(event:FlexEvent):void
{
 // Note that referenceDataMapLayer is an ArcGISDynamicMapServiceLayer from 10.0 SP1
 var token:AsyncToken = referenceDataMapLayer.getLegendInfos(null);
 var responder:mx.rpc.Responder = new mx.rpc.Responder(getLegendResult, getLegendFault);
 token.addResponder(responder);
}

public function getLegendResult(obj:Object):void
{
 trace("We have a result");
}

public function getLegendFault(obj:Object):void
{
 trace("We have an error");
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everytime I invoke the code I get a HTTP error because it appears as though the getLegendsInfos is always sending the request to &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/sharing/tools/legend" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/sharing/tools/legend&lt;/A&gt;&lt;SPAN&gt; - which fails because there is no internet connection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have checked the service info returned for the ArcGISDynamicMapServiceLayer and it is returning the correct version of 10.01 so I would expect it to access the local rest endpoint for the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have i done something wrong or is this a bug.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520300#M11808</guid>
      <dc:creator>AndrewHaigh</dc:creator>
      <dc:date>2021-12-11T22:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520301#M11809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Odd, I seem to have discovered that this works ok but my problem was actually down to an issue with a stale capabilities response been cached by the browser.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oh all working fine now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Dec 2010 08:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520301#M11809</guid>
      <dc:creator>AndrewHaigh</dc:creator>
      <dc:date>2010-12-17T08:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520302#M11810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A bit old... but what capability were you missing?&amp;nbsp; I have Map, Query, Data but am seeing the same issue you described.&amp;nbsp; All getLegendInfos calls always route through the &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/www.arcgis.com"&gt;www.arcgis.com&lt;/A&gt;&lt;SPAN&gt; which completely fails if my local map service isn't externally accessible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2011 23:02:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520302#M11810</guid>
      <dc:creator>DanielBradshaw</dc:creator>
      <dc:date>2011-05-04T23:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520303#M11811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well I'm not totally sure what I did to fix the problem, if I'm honest but here are the steps I completed which seemed to solve the problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Clear the ArcGIS Server Rest Services Cache (&lt;/SPAN&gt;&lt;A href="http://server/ArcGIS/rest/admin"&gt;http://server/ArcGIS/rest/admin&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Clear the browser Cache&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect it was the first change which resolved the problem, but you should be able to check access to the legend via &lt;/SPAN&gt;&lt;A href="http://server/ArcGIS/rest/services/MapServiceName/MapServer/legend"&gt;http://server/ArcGIS/rest/services/MapServiceName/MapServer/legend&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 05:55:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520303#M11811</guid>
      <dc:creator>AndrewHaigh</dc:creator>
      <dc:date>2011-05-05T05:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520304#M11812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I too am having the same issue. My arcgis server is at version 10.01, but when my flex app attempts to call getLegendInfos on a layer the requests is trying to go through arcgis.com to get legend information. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can view the JSON response for my service through the rest legend endpoint in my browswer, so that seems to be working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why are flex calls trying to go through arcgis.com.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have cleared the rest cache, and my browswer cache, neither of those resolved the issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 15:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520304#M11812</guid>
      <dc:creator>JasonTrimble</dc:creator>
      <dc:date>2011-05-05T15:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520305#M11813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm with Jason... cleared every concievable cache possible and the getLegendInfos method still insists on routing through arcgis.com&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 16:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520305#M11813</guid>
      <dc:creator>DanielBradshaw</dc:creator>
      <dc:date>2011-05-12T16:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520306#M11814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I ran into similar problem at some point, which I thought was weird.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up just parsing the json result, which is fast and gives me a little freedom to do some other stuff with it as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://github.com/odoe/LegendViewer/blob/master/src/net/odoe/flexmaptools/components/helpers/LayerExtractor.as"&gt;https://github.com/odoe/LegendViewer/blob/master/src/net/odoe/flexmaptools/components/helpers/LayerExtractor.as&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 17:04:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520306#M11814</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2011-05-12T17:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520307#M11815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response Rene.&amp;nbsp; I originally was using the same methods as you (parsing the JSON directly), but the getLegendInfos gives me information about group layers (using the REST enpoint directly doesn't).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That being said... your suggestion inspired me to work up a new strategy for handling group layers within my application using the REST enpoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the end of the day, I still couldn't get the flex API to do what I wanted, but I'm satisfied with my workaround for now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 13:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520307#M11815</guid>
      <dc:creator>DanielBradshaw</dc:creator>
      <dc:date>2011-05-13T13:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520308#M11816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;That being said... your suggestion inspired me to work up a new strategy for handling group layers within my application using the REST enpoint.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Daniel&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Would you mind sharing your new strategy for this?&amp;nbsp; I'm working on the same thing right now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 15:59:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520308#M11816</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2011-05-13T15:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520309#M11817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No prob...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Disclaimer:&amp;nbsp; This app is a custom app, not built within the flex template. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a property in my config file for each layer in my app called legendGroup.&amp;nbsp; This property contains a comma delimited list of layerIds that participate in the "group".&amp;nbsp; For example, say I have a group layer in my MXD with a layerId of 5, and it's children are layers 6, 7, 8.&amp;nbsp; Each of the children have scale dependencies such that only one of them is visible at any given time and I want my legend to reflect only the visible layer.&amp;nbsp; The layer in my config file would have a legendGroup property = "6,7,8".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While building my legend, I pass the legendGroup property and current map scale of the layer of interest to my legend class.&amp;nbsp; I then loop through the JSON results from the legend REST endpoint and find all the layerIds that match one of the layers within my legendGroup.&amp;nbsp; I then loop through the 3 layers that match and compare the legend scale to the map scale I originally passed in.&amp;nbsp; At this point I can confidently pass the "appropriate" legend data back for further processing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The cons to this solution is you have to manually configure your application to tell it which layers participate in the legend group... but on the flip side you can add as many layers to the group as you want whether they participate in a group layer in the MXD or not, and you always get the legend data for the visible layer in the group.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sense?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 17:38:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520309#M11817</guid>
      <dc:creator>DanielBradshaw</dc:creator>
      <dc:date>2011-05-13T17:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520310#M11818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With the help of Tech Support we were able to determine the issue I was having had to do with the timing of when I was calling the getLayerLegendInfo() method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was dynamically adding a layer to our map in actionscript and then immediately I would call the getLayerLegendInfo() method to store off the legend data for that layer. The problem is, the layer has not completely loaded at that point. Instead you have to register an event listener for LOAD LayerEvent. When that event fires you can then call the getLayerLegendInfo() method and all the legend data is populated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason the requests attempt to proxy thru arcgis.com is that the underlying legend data retrieval code must look at the version property on the layer. That version property is NaN until the layer has loaded completely, once loaded it is 10.01, which signals to not use the arcgisl.com service for legend data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 18:37:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520310#M11818</guid>
      <dc:creator>JasonTrimble</dc:creator>
      <dc:date>2011-05-19T18:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: JSON to LayerLegendInfo</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520311#M11819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can confirm this is correct, I obviously copied an old version of my code onto the forums - sorry everyone!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The correct code snippet is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
protected function referenceDataLayerLoadComplete(event:FlexEvent):void
{
 // Note that referenceDataMapLayer is an ArcGISDynamicMapServiceLayer from 10.0 SP1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // we fire the event on the layer LOAD event, otherwise we end up called arcgis.com :(
 var token:AsyncToken = referenceDataMapLayer.getLegendInfos(null);
 var responder:mx.rpc.Responder = new mx.rpc.Responder(getLegendResult, getLegendFault);
 token.addResponder(responder);
}

public function getLegendResult(obj:Object):void
{
 trace("We have a result");
}

public function getLegendFault(obj:Object):void
{
 trace("We have an error");
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps everyone&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:41:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/json-to-layerlegendinfo/m-p/520311#M11819</guid>
      <dc:creator>AndrewHaigh</dc:creator>
      <dc:date>2021-12-11T22:41:20Z</dc:date>
    </item>
  </channel>
</rss>

