Select to view content in your preferred language

Adding layers dynamically to the map are not visible.....

2154
1
07-17-2012 11:02 PM
srinivasreddy
Deactivated User
I am trying to add layers dynamically to the map component by using the following code with a button click.....

for(var i:int=0;i<4;i++)
{
ArcGISDynamicserviceLayer dyn=new ArcGISDynamicLayer(//URL);
dyn.VisibleLayers=//Some visible Layers array collection....
myMap.addLayer(dyn,i);
}

When i am adding first time it is adding successfully....

But when i remove all the layers i have added and i tried add another set of layers like this with another button click the new set of layers are not visible on the map.....
When i am checking the number of layers on map it showing the count and all urls also....What is the reason for this.....

Thanks & Regards
Srinivas..............
Tags (2)
0 Kudos
1 Reply
Drew
by
Frequent Contributor
Are you sure all the dynamic map services are in the same projection?
Maybe the map service is being added successfully but it's off in never never land.

Maybe create a function to zoom to the new map layer you added to see if you can locate it.
The function below will allow you to quickly zoom to it..
private function zoomToMapLayer():void
{
 myMap.extent = myDynamicLayer.fullExtent;
}


Drew
0 Kudos