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(&quot;featureadded&quot;,&#39;&#39;,FeatureAdded);</div><div>function FeatureAdded(){</div><div>alert(&#39;layer1&#39;);</div><div>};</div><div>layer2.events.register(&quot;featureadded&quot;,&#39;&#39;,FeatureAdded);</div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>function FeatureAdded(){</div><div>alert(&#39;layer2&#39;);</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 </div><div><br></div><div>I can do the following</div><div>    Toggle layer visibility</div><div>    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>-- <br><div>Thanks &amp;&amp; Regards</div>

Rashad<br>
</div>