You may try something like this:
layer1.events.on( {
'featureadded': FeatureAdded,
'scope': layer1
});
layer2.events.on( {
'featureadded': FeatureAdded,
'scope': layer2
});
function FeatureAdded() {
alert(this.name);
}
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 :
layer2.events.un( {
'featureadded': FeatureAdded,
'scope': layer2
});
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/editing-tool-on-multiple-layers-tp6276636p6282577.html
Sent from the OpenLayers Users mailing list archive at Nabble.com._______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users