Get featurelayer from the map object

Discussion created by bforbhavin on Jun 24, 2014
How can I get featureLayer object from the map? I am using ArcGISDynamicMapServiceLayer to show the map on my screen. I have similar scenario as per the following url. However, I need to search parts/equipment from multiple layers. I am adding feature layers as per user's selection using map.addLayer(new FeatureLayer(...)). Once I find parts/equipment in the radius of given geometry, then I highlight them as per the following url. I need to clear the highlighted equipment in certain scenarios. So, I am using clearSelection() of FeatureLayer. But I am not able to get an instance of featureLayer from the map object. I tried map.getLayer() but it doesn't give me any feature layer. Is it because I constructed map using ArcGISDynamicMapServiceLayer? Do I need to construct map using feature layers in such scenario?