when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it. Either that or I'm propagating memory leaks ; )
Can I use arrays to streamline the code (obviously using more than one feature layer), like the following: dojo.connect(wfLayers, "onMouseOver", function(evt) {
dojo.connect(wfLayers, "onMouseOver", function(evt) {
dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, { mode : esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate : template, outFields : ["*"], }); dojo.connect(dwfLayer, "onMouseOver", function(evt) { map.setMapCursor("pointer"); highlightPointLayer.clear(); highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry)); });
var wfLayers = []; dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, { mode : esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate : template, outFields : ["*"], }); wfLayers.push(dwfLayer); dojo.connect(wfLayers, "onMouseOver", function(evt) { map.setMapCursor("pointer"); highlightPointLayer.clear(); highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry)); });
highlight the geometry onmouseover for whichever layers are visible at any one time... the above function works when clicking the map but does anyone know how to achieve the same but only clicking on the feature layer?
//When the layer is switched on: var1 = dojo.connect(layer1, "onClick"....) //When the layer is switched off: dojo.disconnect(var1)
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.