Hi,<br>I did not understand this as I cannot find "Moveend" as a defined event. Or maybe I am missing something.<br>I have the following function under to define the popup box. I tried to write the checkPopup function without success:<br>
<br> // popup box<br> selectControl = new OpenLayers.Control.SelectFeature(map.layers[5],{onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});<br> map.addControl(selectControl);<br> selectControl.activate();<br>
<br> function onPopupClose(evt) {<br> selectControl.unselect(selectedFeature);<br> }<br><br> function onFeatureSelect(feature) {<br> selectedFeature = feature;<br>
popup = new OpenLayers.Popup.FramedCloud("chicken", <br> feature.geometry.getBounds().getCenterLonLat(),<br> new OpenLayers.Size(100,200),<br>
"<h2>" +feature.attributes.gardsnavn + <br> "</h2>Type: "+ feature.attributes.art +<br> "<br />Kommune: "+ feature.attributes.komm +<br>
"<br />Beskrivelse<br /><a href='" + feature.attributes.urltilpdfark + <br> "' target=blank><img src='<a href="http://naturkart.no:8080/geoserver/images/logo.png">http://naturkart.no:8080/geoserver/images/logo.png</a>' border='0' alt='naturkart'></a>", null, true, onPopupClose);<br>
feature.popup = popup;<br> map.addPopup(popup);<br> }<br> function onFeatureUnselect(feature) {<br> map.removePopup(feature.popup);<br> feature.popup.destroy();<br>
feature.popup = null;<br> } <br> function checkPopup(feature) {<br> if (feature.popup!= null){<br> feature.popup.destroy();<br> }<br> }<br> <br>
map.events.register("moveend", map, checkPopup);<br><br><br>/asle<br><br><div class="gmail_quote">2009/6/4 Alexandre Dube <span dir="ltr"><<a href="mailto:adube@mapgears.com">adube@mapgears.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
Register a "moveend" event to your map objet :<br>
<br>
yourMapObj.events.register("moveend", yourMapObj, checkPopup)<br>
<br>
Then, in your checkPopup function, check your map if it has any popup and destroy them.<br>
<br>
Regards,<br>
<br>
Alexandre<br>
<br>
Asle Benoni wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hello,<br>
I have some popups from a WFS layer and a KML layer . When I click the point the popup shows. If I zoom in or out without closing the popup the popup stays and I cannot close it. Is there a way to automatically close any popups that are open when zooming in or out?<br>
<br>
Thanks for any help!<br>
<br>
/asle<br></div></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br>
</blockquote>
<br>
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a><br>
<br>
</blockquote></div><br>