<?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: TOC excludeLayers problem in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614006#M13641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I've tried the code, but when run on the browser nothing appears !!! &amp;amp; when click on screen it becomes totally black, can anyone help me solving that issue?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Mar 2013 09:28:19 GMT</pubDate>
    <dc:creator>YasmineMegahed1</dc:creator>
    <dc:date>2013-03-04T09:28:19Z</dc:date>
    <item>
      <title>TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/613998#M13633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm calling a function on creationComplete of the TOC (I'm using this &lt;/SPAN&gt;&lt;A href="http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=15874" rel="nofollow noopener noreferrer" target="_blank"&gt;TOC&lt;/A&gt;&lt;SPAN&gt;, not the Sample Flex Viewer) in order to exclude some basemap layers from it, and then expand the remaining services.&amp;nbsp; The code works, too, just not without errors.&amp;nbsp; The first error starts with: &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Error #1009: Cannot access a property or method of a null object reference.&lt;BR /&gt; at com.esri.maplib.tocClasses::TocLayerInfoItem/set minScale()&lt;C&gt;&lt;/C&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; then I hit Dismiss All and the next error starts with: &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Error #1009: Cannot access a property or method of a null object reference.&lt;BR /&gt; at com.esri.maplib.tocClasses::TocLayerInfoItem/checkExtent()&lt;C&gt;&lt;/C&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code from my main application file for the TOC, and the function being called:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;maplib:TOC id="TOC" creationComplete="initTOC();"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width="100%" height="100%" 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map="{map}" 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; useLayerFadeEffect="true" 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; excludeGraphicsLayers="true" /&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here's the initTOC function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Exclude base map layers and expand top level TOC items on creationComplete of TOC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; private function initTOC():void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; TOC.excludeLayers = ["World_Street_Map", "World_Topo_Map", "USA_Topo_Maps"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; TOC.openItems = TOC.dataProvider.source;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note:&amp;nbsp; Everything works fine (without errors) when I comment out the TOC.excludeLayers line.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far, I've only been able to find threads for the excludeLayers method for the Sample Flex Viewer Live Maps Widget, and no one using it there seems to be having this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any insight into this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:15:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/613998#M13633</guid>
      <dc:creator>MelonyBarrett</dc:creator>
      <dc:date>2021-12-12T02:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/613999#M13634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Here is an example of how to get it working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:esri="http://www.esri.com/2008/ags" xmlns:maplib="com.esri.maplib.*"
 pageTitle="Flex TOC Sample"
 layout="horizontal"
 paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0"
 horizontalGap="0"
 &amp;gt;
 
 &amp;lt;mx:Panel title="Map Content" width="300" height="100%"&amp;gt;
&amp;nbsp; &amp;lt;maplib:TOC width="100%" height="100%" map="{map}" useLayerFadeEffect="true" excludeGraphicsLayers="true" excludeLayers="{[AerialMap,TopoMap,StreetMap]}"/&amp;gt;
 &amp;lt;/mx:Panel&amp;gt;
 
 &amp;lt;esri:Map id="map"&amp;gt;
&amp;nbsp; &amp;lt;!-- base maps --&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer id="AerialMap" visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer id="TopoMap" visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcIMSMapServiceLayer id="IMSWorld" visible="false" serviceHost="http://www.geographynetwork.com" serviceName="ESRI_World"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer id="StreetMap" visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/&amp;gt;
&amp;nbsp; 
&amp;nbsp; &amp;lt;!-- base map overlays --&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_Transportation_World_2D/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_Boundaries_World_2D/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_BoundariesPlacesAlt_World_2D/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_BoundariesPlaces_World_2D/MapServer"/&amp;gt;
&amp;nbsp; 
&amp;nbsp; &amp;lt;!-- thematic overlays --&amp;gt;
&amp;nbsp; &amp;lt;esri:ArcGISDynamicMapServiceLayer visible="false" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/&amp;gt;
&amp;nbsp; &amp;lt;esri:GraphicsLayer visible="true"&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:Graphic&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:geometry&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:MapPoint x="-117.195533" y="34.057058"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:geometry&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:symbol&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleMarkerSymbol style="diamond" color="0x33FF00" alpha="0.8" size="18"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:symbol&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/esri:Graphic&amp;gt;
&amp;nbsp; &amp;lt;/esri:GraphicsLayer&amp;gt;
 &amp;lt;/esri:Map&amp;gt;
&amp;lt;/mx:Application&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/613999#M13634</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T02:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614000#M13635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, that worked!&amp;nbsp; So simple.&amp;nbsp; Do I understand correctly, that by calling my function with excludeLayers in it in the creationComplete event, I was calling it too late?&amp;nbsp; Is your solution the same thing as calling the function with excludeLayers in it from the initialize event?&amp;nbsp; I'm just trying to understand so I can store it away in my brain for future reference.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You and some other notables have been an invaluable resource to me since starting out with Flex in October 2009.&amp;nbsp; I've received a &lt;/SPAN&gt;&lt;STRONG&gt;real education &lt;/STRONG&gt;&lt;SPAN&gt;from your answers to my posts and others' posts.&amp;nbsp; Yay!&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Melony&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 13:53:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614000#M13635</guid>
      <dc:creator>MelonyBarrett</dc:creator>
      <dc:date>2010-06-24T13:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614001#M13636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The way I am doing it in the sample is I am passing an array of Layer objects and not an array of strings like you were. The array of strings will work also if those are the EXACT ids of the layers in your code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 14:00:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614001#M13636</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-06-24T14:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614002#M13637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, duh, I'm glad I asked.&amp;nbsp; Funny how you can look at something, but not SEE it.&amp;nbsp; I'm always trying to make it harder than it is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Melony&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 15:08:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614002#M13637</guid>
      <dc:creator>MelonyBarrett</dc:creator>
      <dc:date>2010-06-24T15:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614003#M13638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Melony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The link which you have provided in the thread for TOC,can you share it with me I am currently facing the same problem. I want to hide some of the layers from my TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be great&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanya Bisen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2011 10:02:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614003#M13638</guid>
      <dc:creator>tanyabisen</dc:creator>
      <dc:date>2011-06-06T10:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614004#M13639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just do exactly what Robert said.&amp;nbsp; Your TOC mxml should look something like the following code (where AerialMap, TopoMap, and StreetMap are the ids of the services you want to exclude from the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;lt;maplib:TOC width="100%" height="100%" map="{map}" useLayerFadeEffect="true" excludeGraphicsLayers="true" excludeLayers="{[AerialMap,TopoMap,StreetMap]}"/&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of the mxml for one of the excluded layers, AerialMap (notice the id):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;lt;esri:ArcGISTiledMapServiceLayer id="AerialMap" visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2011 12:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614004#M13639</guid>
      <dc:creator>MelonyBarrett</dc:creator>
      <dc:date>2011-06-06T12:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614005#M13640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Melony..Sorry for replying late..Thanks for the reply...its working now... but now I just have one issue... since I am using Bing maps as my base map...I can see that service also in my TOC with "Unknown " name... how do i change the name... ???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jul 2011 03:08:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614005#M13640</guid>
      <dc:creator>tanyabisen</dc:creator>
      <dc:date>2011-07-05T03:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614006#M13641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I've tried the code, but when run on the browser nothing appears !!! &amp;amp; when click on screen it becomes totally black, can anyone help me solving that issue?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 09:28:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614006#M13641</guid>
      <dc:creator>YasmineMegahed1</dc:creator>
      <dc:date>2013-03-04T09:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: TOC excludeLayers problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614007#M13642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yasmine,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, are you saying that you are trying to get this to work in an old 2.x version of the FlexViewer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure what you are asking, as if you have the new viewer and installed the latest TOC widget as described in the documentation, then this code shouldn't be needed as the exlcudelayers is a configurable option now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 22:40:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-excludelayers-problem/m-p/614007#M13642</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-03-04T22:40:55Z</dc:date>
    </item>
  </channel>
</rss>

