<div dir="ltr">Hi all,<div><br></div><div>I am&nbsp;having&nbsp;one trouble and I don&#39;t know what else to do.&nbsp;</div><div><br></div><div>I have my map and I have develop some javascript code that is working fine.&nbsp;</div><div>What happened this weekend is that I developed a function that had that some layers in the beginning:</div>
<div><br></div><div><br></div><div><div>var myStyle128684655922811250 = new OpenLayers.StyleMap({fillOpacity: 0.5});var rules128684655922811250 = {0: {fillColor: &#39;#ffffff&#39;, fillOpacity:0.5} &nbsp; };&nbsp;</div><div><br></div>
<div>myStyle128684655922811250.addUniqueValueRules(&#39;default&#39;, &#39;type&#39;, rules128684655922811250);</div><div><br></div><div>var layer128684655922811250 = new OpenLayers.Layer.GML(&#39;mercury layer&#39;, &#39;../GML/glmush55qv3web45ak21mhrf128684655922811250.xml&#39;,{styleMap: myStyle128684655922811250} );&nbsp;</div>
<div><br></div><div>map.addLayer(layer128684655922811250);</div><div><br></div><div><br></div></div><div>and this is working fine. &nbsp;What is really funny is that the following code only works if the code above is outside a function. If the code above is inside the init() function then this code don&#39;t work:</div>
<div><div><br></div><div>//// REMOVE THE LAYER</div><div>map.removeLayer(layer128684657963905000);</div><div>layer128684657963905000.destroy();</div></div><div><br></div><div><br></div><div>Why??? Anybody knows why??????</div>
<div><br></div><div>Thanks</div><div><br></div><div>Best,</div><div><br>Carlos</div></div>