<?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 LayerList Widget null object error in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/layerlist-widget-null-object-error/m-p/91981#M3441</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have evoked the LayerList widget in one of my config files that has some services that a secured with a token embed in the config file.&amp;nbsp; The viewer and layers all load fine. However, when I select the LayerList widget I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: Error #1009: Cannot access a property or method of a null object reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/createChildren()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/registerMapLayer()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at MethodInfo-307()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.utils::MapUtil$/forEachMapLayer()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/registerAllMapLayers()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/commitProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.core::UIComponent/validateProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/validateProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/doPhasedInstantiation()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/doPhasedInstantiationCallback()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idears?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Oct 2013 17:44:51 GMT</pubDate>
    <dc:creator>FrankRoberts</dc:creator>
    <dc:date>2013-10-25T17:44:51Z</dc:date>
    <item>
      <title>LayerList Widget null object error</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/layerlist-widget-null-object-error/m-p/91981#M3441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have evoked the LayerList widget in one of my config files that has some services that a secured with a token embed in the config file.&amp;nbsp; The viewer and layers all load fine. However, when I select the LayerList widget I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: Error #1009: Cannot access a property or method of a null object reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/createChildren()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/registerMapLayer()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at MethodInfo-307()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc.utils::MapUtil$/forEachMapLayer()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/registerAllMapLayers()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer.components.toc::TOC/commitProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.core::UIComponent/validateProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/validateProperties()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/doPhasedInstantiation()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.managers::LayoutManager/doPhasedInstantiationCallback()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idears?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 17:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/layerlist-widget-null-object-error/m-p/91981#M3441</guid>
      <dc:creator>FrankRoberts</dc:creator>
      <dc:date>2013-10-25T17:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList Widget null object error</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/layerlist-widget-null-object-error/m-p/91982#M3442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tracked it down to being a problem with the Secure services? Did everything work fine with the Secure services removed from the config file? If it did, maybe try leaving the Secured services turned on, but remove all of the pop-ups for the Secure services and see if you get the same error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if my problem from a few months ago is the same as what you are experiencing, but it's worth a try. I was experiencing issues with the createChildren due to some kind of popup config related bug, and this is how I fixed it back then:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is how I fixed this in the createChildren function in TocMapLayerItem.as found in Robert's TOC Widget v 3.3.0 (5/6/13) code here: /widgets/TOC/toc/tocClasses/TocMapLayerItem.as around line 912:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private function createChildren():void
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; children = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var layerInfos:Array; // of LayerInfo
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var visibleLayers:Array;
&amp;nbsp;&amp;nbsp; var li:LayerInfo;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layer is ArcGISTiledMapServiceLayer){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerInfos = ArcGISTiledMapServiceLayer(layer).layerInfos;
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;&amp;nbsp; }else if (layer is ArcGISDynamicMapServiceLayer){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var arcGISDynamicMapServiceLayer:ArcGISDynamicMapServiceLayer = ArcGISDynamicMapServiceLayer(layer);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (arcGISDynamicMapServiceLayer.visibleLayers == null) { //Added if check for bugfix
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace("found null");
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; _visibleLayersChangeWatcher = ChangeWatcher.watch(arcGISDynamicMapServiceLayer, "visibleLayers", visibleLayersChange);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; _dynamicMapServiceLayerInfos = arcGISDynamicMapServiceLayer.dynamicLayerInfos ? arcGISDynamicMapServiceLayer.dynamicLayerInfos : arcGISDynamicMapServiceLayer.layerInfos; //Added per commit on GH
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_isVisibleLayersSet){
....all code is the same for the rest of the createChildren function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As shown in this post in Robert's retired TOC thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/18453-Table-of-Contents-Legend-Widget-for-FlexViewer-2.x?p=312248&amp;amp;viewfull=1#post312248" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/18453-Table-of-Contents-Legend-Widget-for-FlexViewer-2.x?p=312248&amp;amp;viewfull=1#post312248&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this doesn't fix it, can you post any further information on your error messages either in Flash Builder or the Flash Player Debug information popup? I notice that sometimes my Debug Flash Player Error Message is actually better at helping me track down the problem than the error message I get in Debug mode inside Flash Builder, although I have no idea why that happens.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:31:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/layerlist-widget-null-object-error/m-p/91982#M3442</guid>
      <dc:creator>GISDev1</dc:creator>
      <dc:date>2021-12-10T23:31:48Z</dc:date>
    </item>
  </channel>
</rss>

