You may try something like this:
<pre>layer1.events.on( {
'featureadded': FeatureAdded,
'scope': layer1
});
layer2.events.on( {
'featureadded': FeatureAdded,
'scope': layer2
});
function FeatureAdded() {
alert(this.name);
}</pre>
The 'scope' property lets you use the keyword 'this' as a reference to the layer.
And yes, remember to unregister events if you need to destroy the layer, with the 'un' function :
<pre>layer2.events.un( {
'featureadded': FeatureAdded,
'scope': layer2
}); </pre>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/editing-tool-on-multiple-layers-tp6276636p6282577.html">Re: editing tool on multiple layers</a><br/>
Sent from the <a href="http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>