[OpenLayers-Users] activate / deactivate events

Andreas Hocevar ahocevar at opengeo.org
Sat Sep 17 06:48:32 EDT 2011


Hi Karsten,

in order to unregister events, you cannot use an anonymous function. You would have to do something like the following:

function handler(e) {...}
map.events.register('click', map, handler);

And then you can simply unregister the event using

map.events.unregister('click', map, handler);

Andreas.

On Sep 17, 2011, at 01:45 , karsten vennemann wrote:

> Hi all,
>  
> I have a click event registered on the map:
>  
> map.events.register('click', map, function (e) {
> ... code to be executed...
> }
> How can I activate or deactivate this event ?
> If it was an OpenLayers control called 'infofeature' I could do e.g.
> infofeature.activate(); 
> and
> infofeature.deactivate();
>  
> How could I achieve this for the above event ?
>  
> Thanks
> Karsten
>  
> Karsten Vennemann
> 
> Terra GIS LTD
> Seattle, WA  98112
> USA 
> www.terragis.net
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list