[OpenLayers-Users] How to stop registering events

Max Stephan x.zam at gmx.net
Thu Oct 29 08:00:39 EDT 2009


Hi list,

I´m using layer.events.register('loadend',map,zoomToFeature); in my
application. The scenario is the following:
In a list the user clicks on an icon that represents a polygon-Feature and
has an ID. After that I´m querying my Geoserver for the feature with this ID
and get the response back. From this I can calculate the bounds of this
geometry and zoom to it.
Now I want to select this layer because most of the features are surrounded
by other features to show the user which one he selected in the list. For
this to happen I have to wait till the layer is loaded (it contains all the
features of the same featureclass that I´m querying from the Geoserver).
Then I´m selecting the feature via selectControl.select(//FeatureObject//);.
The problem is: The script keeps on registering the loadend event and for
that reason always reactivates the queried feature (for example when I click
on another feature).
So, what I need is a way to deactivate the registering after the first
registration of the event. I tried
layer.events.unregister('loadend',map,zoomToFeature); but that´s not
working. In addition I´m not completely sure which params I should give to
the unregister-function and what the unregister-function does.

Thx for your help in advance
Max Stephan
-- 
View this message in context: http://n2.nabble.com/How-to-stop-registering-events-tp3911670p3911670.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list