Identify difference between ArcGISDynamicLayer and GraphicsLayer on layer-add-result event?

3711
2
07-21-2014 06:15 AM
BhavinSanghani
Occasional Contributor II

I am using ArcGISDynamicLayer on my map and executing some code when this layer is added to the map in layer-add-result event. Now, I have few GraphicsLayer too on my map, whenever they are added then same layer-add-result event is getting fired. But I want to avoid this event to fire when GraphicsLayer is added Or identify type of the layer in the callback function of this event so, I can control execution of the code in the callback function depends upon the type of the layer. What is the best way to identify that? Is there any property that can say type of the layer?

0 Kudos
2 Replies
TimWitt2
MVP Alum

Bhavin,

There is a difference between layers-add-result, which fires after all layers have been added and layer-add-result.

in the layer-add-result, you can specify a layer and it the code will only run when that layer has been added.

Just write a layer-add-result for the graphic layers and one for your ArcGISDynamicLayer.

Tim

0 Kudos
BhavinSanghani
Occasional Contributor II

I added id property to ArcGISDynamicLayer and GraphicsLayer that I created in my code. Then identifying type of the layer within layer-add-result to avoid execution on GraphicsLayer. We can add layer-add-result on the map, I don’t think we can add it different for ArcGISDynamicLayer and GraphicsLayer.

0 Kudos