<div dir="ltr"><div>Hi, everyone!</div><div><br></div><div>I am working on a GIS API, that uses OpenLayers. I initialize the map lke this:</div><div><br></div><div><br></div><div><font color="#ff0000">    xgis.map = OpenLayers.Class(OpenLayers.Map, {</font></div>
<div><font color="#ff0000">        var mapOptions = {};</font></div><div><font color="#ff0000">        mapOptions.allOverlays = false;</font></div><div><font color="#ff0000">        /*</font></div><div><font color="#ff0000">            more mapOptions here</font></div>
<div><font color="#ff0000">        */</font></div><div><font color="#ff0000">        OpenLayers.Map.prototype.initialize.apply(this, ['map', mapOptions]);</font></div><div><font color="#ff0000">    });</font></div>
<div><br></div><div>Of course, I do this because I want to create my own methods, like this one, for example.</div><div><br></div><div><font color="#ff0000">    xgis.map.prototype.zoom(action) {</font></div><div><font color="#ff0000">        switch(action) {</font></div>
<div><font color="#ff0000">            case 'in:</font></div><div><font color="#ff0000">                this.zoomIn();    // Uses the OpenLayers zoomIn method</font></div><div><font color="#ff0000">                break;</font></div>
<div><font color="#ff0000">            case 'out:</font></div><div><font color="#ff0000">                this.zoomOut();    // Uses the OpenLayers zoomOut method</font></div><div><font color="#ff0000">                break;</font></div>
<div><font color="#ff0000">    };</font></div><div><br></div><div>The problem is this 'zoom' method I created is not recognized as a function (I get: number is not a function), because OpenLayers has a 'zoom' numeric value where it stores the zoom.</div>
<div><br></div><div>Is there a way to use inheritance and access the parent's methods like this?</div><div><br></div><div><font color="#ff0000">    this.parent.zoomIn()</font></div><div><br></div><div>This would definitely fix the 'zoom' name problem.</div>
<div><br></div><div>Thanks.</div><div><br></div><div>João Rodrigues</div></div>