I'm calling a function on creationComplete of the TOC (I'm using this TOC, not the Sample Flex Viewer) in order to exclude some basemap layers from it, and then expand the remaining services. The code works, too, just not without errors. The first error starts with: Error #1009: Cannot access a property or method of a null object reference.
at com.esri.maplib.tocClasses::TocLayerInfoItem/set minScale()
then I hit Dismiss All and the next error starts with: Error #1009: Cannot access a property or method of a null object reference.
at com.esri.maplib.tocClasses::TocLayerInfoItem/checkExtent()
Here's the code from my main application file for the TOC, and the function being called: <maplib:TOC id="TOC" creationComplete="initTOC();"
width="100%" height="100%"
map="{map}"
useLayerFadeEffect="true"
excludeGraphicsLayers="true" /> And here's the initTOC function: //Exclude base map layers and expand top level TOC items on creationComplete of TOC
private function initTOC():void
{
TOC.excludeLayers = ["World_Street_Map", "World_Topo_Map", "USA_Topo_Maps"];
TOC.openItems = TOC.dataProvider.source;
}Note: Everything works fine (without errors) when I comment out the TOC.excludeLayers line. 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.Thanks in advance for any insight into this issue.