<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> </div><div>Best, </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"><<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a>></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>
xxx = new ......;<br>
}<br>
<br>
Best regards,<br>
Bart<br>
<div><div></div><div class="Wj3C7c"><br>
> Hi all,<br>
> I am having one trouble and I don't know what else to do.<br>
><br>
> I have my map and I have develop some javascript code that is working<br>
> fine.<br>
> What happened this weekend is that I developed a function that had that<br>
> some<br>
> layers in the beginning:<br>
><br>
><br>
> var myStyle128684655922811250 = new OpenLayers.StyleMap({fillOpacity:<br>
> 0.5});var rules128684655922811250 = {0: {fillColor: '#ffffff',<br>
> fillOpacity:0.5} };<br>
><br>
> myStyle128684655922811250.addUniqueValueRules('default', 'type',<br>
> rules128684655922811250);<br>
><br>
> var layer128684655922811250 = new OpenLayers.Layer.GML('mercury layer',<br>
> '../GML/glmush55qv3web45ak21mhrf128684655922811250.xml',{styleMap:<br>
> myStyle128684655922811250} );<br>
><br>
> map.addLayer(layer128684655922811250);<br>
><br>
><br>
> and this is working fine. What is really funny is that the following code<br>
> only works if the code above is outside a function. If the code above is<br>
> inside the init() function then this code don't work:<br>
><br>
> //// REMOVE THE LAYER<br>
> map.removeLayer(layer128684657963905000);<br>
> layer128684657963905000.destroy();<br>
><br>
><br>
> Why??? Anybody knows why??????<br>
><br>
> Thanks<br>
><br>
> Best,<br>
><br>
> Carlos<br>
</div></div>> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
><br>
<br>
<br>
</blockquote></div><br></div></div>