[OpenLayers-Users] overwriting functions

Kevin Kempfer mail at kevinkempfer.de
Mon Sep 17 09:22:20 EDT 2007


Hi,

simple question: How can I overwrite specific functions? For example, I 
would like to overwrite OpenLayers.Control.SelectFeature.downfeature() 
with my own function. Here's what I tried:
--
OpenLayers.Control.SelectFeature.downFeature = function(feature){
alert('Overwritten!');
};
map = new OpenLayers.Map('map', {controls: []});
mySelect = new OpenLayers.Control.SelectFeature(vectors, {onSelect: 
serialize, onUnselect: deselect,multiple: true});
map.addControl(mySelect);
--
doesn't work, second try:
--
map = new OpenLayers.Map('map', {controls: []});
mySelect = new OpenLayers.Control.SelectFeature(vectors, {onSelect: 
serialize, onUnselect: deselect,multiple: true});
mySelect.downFeature = function(feature){
alert('Overwritten!');
};
map.addControl(mySelect);
--

Doesn't work, too. I think I just don't see the beginners mistake...

Thanks,

Kevin.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3249 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070917/16e8aa8f/smime.bin


More information about the Users mailing list