Hi,<br>I've two overlays, one is a Vector layers of markers built from a kml file, <br>the other is a GML geometric layer from an xml file.<br>I've added a SelectFeature for each layer, but if I add first layer1 then layer2 <br>
only selectFeature for layer2 work. On otherwise if I add layer2 then layer1 only<br>selectFeature for layer1 work, there is a way to make working both layers?<br>Here the code:<br><br>var layer1 = new OpenLayers.Layer.Vector("Segnalazioni", {<br>
'displayInLayerSwitcher':false,<br> styleMap: new OpenLayers.StyleMap(style),<br> projection: map.displayProjection,<br> strategies: [new OpenLayers.Strategy.Fixed()],<br> protocol: new OpenLayers.Protocol.HTTP({<br>
url: "file.kml",<br> format: new OpenLayers.Format.KML({<br> extractStyles: false,<br> extractAttributes: true<br> })<br> })<br>});<br> <br>var layer2 = new OpenLayers.Layer.GML(<br>
"GML",<br> "file.xml",<br> {<br> projection: map.displayProjection,<br> styleMap: myStyleMap,<br> 'displayInLayerSwitcher':false,<br> 'isBaseLayer':false<br>
}<br>);<br><br><br><br><br>selectControl = new OpenLayers.Control.SelectFeature(<br> layer2,<br> {<br> clickout: true, toggle: true,<br> multiple: false, hover: true<br> }<br>);<br> <br>
layer2.events.on(<br> {<br> "featureselected": function(e) {<br> alert("Selected.");<br> },<br> "featureunselected": function(e) {<br> alert("Unselected.");<br>
}<br> }<br>);<br> <br>map.addControl(selectControl);<br>selectControl.activate();<br><br>select = new OpenLayers.Control.SelectFeature(layer1);<br>layer1.events.on(<br> {<br> "featureselected": onFeatureSelect,<br>
"featureunselected": onFeatureUnselect<br> }<br>);<br><br>map.addControl(select);<br>select.activate(); <br> <br>