Error #1009: Cannot access a property or method of a null object reference.then I hit Dismiss All and the next error starts with:
at com.esri.maplib.tocClasses::TocLayerInfoItem/set minScale()
Error #1009: Cannot access a property or method of a null object reference.
at com.esri.maplib.tocClasses::TocLayerInfoItem/checkExtent()
<maplib:TOC id="TOC" creationComplete="initTOC();" width="100%" height="100%" map="{map}" useLayerFadeEffect="true" excludeGraphicsLayers="true" />
//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; }
<?xml version="1.0" encoding="utf-8"?> <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" > <mx:Panel title="Map Content" width="300" height="100%"> <maplib:TOC width="100%" height="100%" map="{map}" useLayerFadeEffect="true" excludeGraphicsLayers="true" excludeLayers="{[AerialMap,TopoMap,StreetMap]}"/> </mx:Panel> <esri:Map id="map"> <!-- base maps --> <esri:ArcGISTiledMapServiceLayer id="AerialMap" visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/> <esri:ArcGISTiledMapServiceLayer id="TopoMap" visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer"/> <esri:ArcIMSMapServiceLayer id="IMSWorld" visible="false" serviceHost="http://www.geographynetwork.com" serviceName="ESRI_World"/> <esri:ArcGISTiledMapServiceLayer id="StreetMap" visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/> <!-- base map overlays --> <esri:ArcGISTiledMapServiceLayer visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_Transportation_World_2D/MapServer"/> <esri:ArcGISTiledMapServiceLayer visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_Boundaries_World_2D/MapServer"/> <esri:ArcGISTiledMapServiceLayer visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_BoundariesPlacesAlt_World_2D/MapServer"/> <esri:ArcGISTiledMapServiceLayer visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_BoundariesPlaces_World_2D/MapServer"/> <!-- thematic overlays --> <esri:ArcGISDynamicMapServiceLayer visible="false" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/> <esri:GraphicsLayer visible="true"> <esri:Graphic> <esri:geometry> <esri:MapPoint x="-117.195533" y="34.057058"/> </esri:geometry> <esri:symbol> <esri:SimpleMarkerSymbol style="diamond" color="0x33FF00" alpha="0.8" size="18"/> </esri:symbol> </esri:Graphic> </esri:GraphicsLayer> </esri:Map> </mx:Application>
<maplib:TOC width="100%" height="100%" map="{map}" useLayerFadeEffect="true" excludeGraphicsLayers="true" excludeLayers="{[AerialMap,TopoMap,StreetMap]}"/>
<esri:ArcGISTiledMapServiceLayer id="AerialMap" visible="true" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>