Select to view content in your preferred language

Why layerInfos = null?

1440
1
04-20-2011 07:27 AM
WaltBulawa
Emerging Contributor
In Flex, why does the line: var layer:Layer = new ArcGISDynamicMapServiceLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"); yield only a NULL value for layerInfos (looking at variables in debug mode)?  Shouldn't it have something - like an array of values identifying the sublayers?

I also tried it this way: var layerInfos:Array = new ArcGISDynamicMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServe...").layerInfos; which yielded a NULL as well.
Tags (2)
0 Kudos
1 Reply
WaltBulawa
Emerging Contributor
Thank me myself for this response to my problem.

myLayer = new ArcGISDynamicMapServiceLayer("http://gis.idaho.gov/ArcGIS/rest/services/IdahoParcels6/MapServer");    
myLayer.addEventListener(LayerEvent.LOAD,getLayerInfos);

Adding the event listener, as shown immediatly above, allows me to sample the data with some assurance that it has indeed been loaded.  In my initial problem, I was apparently sampling the data before the data had time to be completely uploaded and so I got null values for various attributes.

So case closed - problem solved.

Thank me.
0 Kudos