AnsweredAssumed Answered

How to get layer orders displayed and layers in proper order

Question asked by dar104 on Jan 12, 2012
Latest reply on May 6, 2013 by danwallie
I am adding three layers to a map in this order:

basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL); map.addLayer(basemap);  kml = new esri.layers.KMLLayer(kmlUrl);  map.addLayer(kml);  dataLayer = new esri.layers.GraphicsLayer(); map.addLayer(dataLayer);


When I print the layer.id for each I get the following:
dataLayer = graphicsLayer2
kml = layer1
basemap = layer0

I want my dataLayer to be the top layer but it seems no matter what I do the kml layer is on top.  I tried reorderLayer and put the graphics layer in index 2 and still same result.  How can I display the real order of all layers in a map and get my dataLayer on top?

Outcomes