[OpenLayers-Users] Overwrite and extend initialize function of a class

Armin Burger armin.burger at gmx.net
Wed Feb 15 14:01:52 EST 2012


Hi all

I would like to overwrite and extend the "initialize" function of a 
class. For all other functions I used the method via

OpenLayers.My_CLASS.prototype.funtionToOverWrite = function() {

but in the case of the initialize function this does not show any effect 
(it is not used). OL version used is 2.11

In addition I would not like to completely rewrite the function but 
extend it. I mean, calling the original function and then adding a few 
lines of code afterwards. Is this possible? If I create a new class 
inheriting from another I just can call the parent class like

OpenLayers.Control.Parent_Class.prototype.initialize.functionToExtend(this,...);

and add my code afterwards. But this does not work when modifying an 
existing class.

Any ideas how to achieve these goals?

Thanks in advance for any hints
Armin


More information about the Users mailing list