<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY>
<DIV><SPAN class=758332319-15042011><FONT color=#0000ff size=2 
face=Arial>try</FONT></SPAN></DIV>
<DIV>layer1.events.<SPAN 
class=758332319-15042011>un</SPAN>register("featureadded",'',FeatureAdded);</DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><SPAN class=758332319-15042011></SPAN>t<SPAN class=758332319-15042011>o 
unregister your event, before you register the new one.</SPAN></DIV>
<DIV><SPAN class=758332319-15042011><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=758332319-15042011><FONT color=#0000ff size=2 
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Mohammed 
Rashad<BR><B>Gesendet:</B> Freitag, 15. April 2011 17:07<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> [OpenLayers-Users] editing 
tool on multiple layers<BR></FONT><BR></DIV>
<DIV></DIV><SPAN 
style="BORDER-COLLAPSE: collapse; FONT-FAMILY: arial, sans-serif; FONT-SIZE: 13px" 
class=Apple-style-span>I have two layers
<DIV>layer1</DIV>
<DIV>layer2</DIV>
<DIV>both are editable vector layers</DIV>
<DIV><BR></DIV>
<DIV>for layer1 is point layer and layer2 is poygon layers</DIV>
<DIV>I had registered some events. both are sharing same events but the 
behaviour of events is different</DIV>
<DIV>for example</DIV>
<DIV><BR></DIV>
<DIV>layer1.events.register("featureadded",'',FeatureAdded);</DIV>
<DIV>function FeatureAdded(){</DIV>
<DIV>alert('layer1');</DIV>
<DIV>};</DIV>
<DIV>layer2.events.register("featureadded",'',FeatureAdded);</DIV>
<DIV>function FeatureAdded(){</DIV>
<DIV>alert('layer2');</DIV>
<DIV>};</DIV>
<DIV><BR></DIV>
<DIV>how to define the function as local to a specific layer so that I can use 
the same function defined twice whose defenition is different.?</DIV>
<DIV><BR></DIV>
<DIV>Can I remove the function from the code dynamically?</DIV>
<DIV><BR></DIV>
<DIV>How to register a function local to the layer.</DIV>
<DIV>I will dynamically change the layer using checkboxes which are not part of 
OpenLayers.</DIV>
<DIV>when I check the checkbox&nbsp;</DIV>
<DIV><BR></DIV>
<DIV>I can do the following</DIV>
<DIV>&nbsp;&nbsp; &nbsp;Toggle layer visibility</DIV>
<DIV>&nbsp;&nbsp; &nbsp;destroy controlpanel and create tie it to the new layer 
(say layer 2)</DIV>
<DIV><BR></DIV>
<DIV>I redefined the functions for featureadded event (FeatureAdded) but the old 
function is in use not the redefined one</DIV>
<DIV>How can I use the newly defined FeatureAdded function for a featureadded 
event after changing the layer</DIV>
<DIV><BR></DIV>
<DIV>I think some questions are not related to OpenLayers. if so forgive 
me</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>Any help will be greatly appreciated</DIV>
<DIV><BR></DIV></SPAN><BR>-- <BR>
<DIV>Thanks &amp;&amp; Regards</DIV>Rashad<BR></BODY></HTML>