[OpenLayers-Dev] unregister the click event

Eric Lemoine eric.c2c at gmail.com
Tue Jun 24 10:43:16 EDT 2008


On Tue, Jun 24, 2008 at 11:09 AM,  <bartvde at osgis.nl> wrote:
> I don't think this will work with anonymous functions.
>
> Try something like:
>
> function myfunc(e) {
>  // do your stuff here
> }
>
> map.events.register('click', map, myfunc);
> map.events.unregister('click', map, myfunc);

Indeed. Unregister must be passed a reference to a registered
function. If you do unregister('click', map, function(e) {}) you're
guaranteed that this won't work - the anonymous function you're
passing to unregister() isn't registered.

--
Eric
>
> Best regards,
> Bart
>
> On Tue, 24 Jun 2008 19:05:33 +1000, "Darko Radiceski" <radiceski at gmail.com>
> wrote:
>> Greetings all,
>>
>> I have something like this:
>>
>> map.events.register('click', map, function (e) {
>>
>> that would register the click event.
>>
>> but i would like to be able to unregister that click event.
>>
>> I seem to not be able to do that.
>>
>> I tried:
>>
>> map.events.unregister('click', map, function (e) {});
>>
>> but that does not work.
>>
>> Any ideas?
>>
>> cheers
>> Dan
>>
>> --
>> Radiceski Dan
>> University of Wollongong
>> Australia
>> SIFE - UOW Chapter - Alumni
>> CASUAL ACADEMIC STAFF TEACHING - UOW SITACS
>> (School of Information Technology and Computer Science,University of
>> Wollongong)
>> Univeristy of Wollongong - Alumni
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>



More information about the Dev mailing list