<div dir="ltr">Thanks very much.<div><br></div><div>I feel a little bit dum. But at least the problem is solved.</div><div>&nbsp;</div><div>Best,&nbsp;</div><div><br></div><div>Carlos</div><div><br><br><div class="gmail_quote">On Tue, Oct 14, 2008 at 5:01 PM,  <span dir="ltr">&lt;<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Probably this is because of the scope of your variable.<br>
<br>
If you define var xxxx in a function, it only has a local scope inside of<br>
the function, outside of the function it is not accessible.<br>
<br>
Instead, you can define the variable outside of the function with the var<br>
keyword.<br>
<br>
var xxxx = null;<br>
<br>
function init() {<br>
 &nbsp;xxx = new ......;<br>
}<br>
<br>
Best regards,<br>
Bart<br>
<div><div></div><div class="Wj3C7c"><br>
&gt; Hi all,<br>
&gt; I am having one trouble and I don&#39;t know what else to do.<br>
&gt;<br>
&gt; I have my map and I have develop some javascript code that is working<br>
&gt; fine.<br>
&gt; What happened this weekend is that I developed a function that had that<br>
&gt; some<br>
&gt; layers in the beginning:<br>
&gt;<br>
&gt;<br>
&gt; var myStyle128684655922811250 = new OpenLayers.StyleMap({fillOpacity:<br>
&gt; 0.5});var rules128684655922811250 = {0: {fillColor: &#39;#ffffff&#39;,<br>
&gt; fillOpacity:0.5} &nbsp; };<br>
&gt;<br>
&gt; myStyle128684655922811250.addUniqueValueRules(&#39;default&#39;, &#39;type&#39;,<br>
&gt; rules128684655922811250);<br>
&gt;<br>
&gt; var layer128684655922811250 = new OpenLayers.Layer.GML(&#39;mercury layer&#39;,<br>
&gt; &#39;../GML/glmush55qv3web45ak21mhrf128684655922811250.xml&#39;,{styleMap:<br>
&gt; myStyle128684655922811250} );<br>
&gt;<br>
&gt; map.addLayer(layer128684655922811250);<br>
&gt;<br>
&gt;<br>
&gt; and this is working fine. &nbsp;What is really funny is that the following code<br>
&gt; only works if the code above is outside a function. If the code above is<br>
&gt; inside the init() function then this code don&#39;t work:<br>
&gt;<br>
&gt; //// REMOVE THE LAYER<br>
&gt; map.removeLayer(layer128684657963905000);<br>
&gt; layer128684657963905000.destroy();<br>
&gt;<br>
&gt;<br>
&gt; Why??? Anybody knows why??????<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt; Best,<br>
&gt;<br>
&gt; Carlos<br>
</div></div>&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
&gt;<br>
<br>
<br>
</blockquote></div><br></div></div>