change this:<br><pre id="line11">map.setBaseLayer(newBaseLayer);<br></pre>to this:<br><span class="objectBox objectBox-text">map.setBaseLayer(window[newBaseLayer]);</span><br><br>you need the variable, not hte string.<br><br>
<div><span class="gmail_quote">On 10/29/07, <b class="gmail_sendername">bradleyspencer</b> &lt;<a href="mailto:brad@cubewerx.com.au">brad@cubewerx.com.au</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Chris,<br><br>I tried looking at the layerswitcher mouse handling code but that was even<br>more confusing to me :(<br><br>I have built a little tester app:<br><a href="http://demo.cubewerx.com.au/NuMaps/baseLayerTest.html">
http://demo.cubewerx.com.au/NuMaps/baseLayerTest.html</a><br><br>Can you just have a quick look at this for me its probably going to<br>something very simple. I&#39;d appreciate it.<br><br>Cheers,<br><br>Brad<br><br>-----Original Message-----
<br>From: Christopher Schmidt [mailto:<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>]<br>Sent: Tuesday, 30 October 2007 1:25 PM<br>To: bradleyspencer<br>Cc: openlayers users<br>Subject: Re: [OpenLayers-Users] changing Base layers
<br><br>On Tue, Oct 30, 2007 at 12:42:06PM +1100, bradleyspencer wrote:<br>&gt; Chris,<br>&gt;<br>&gt; I guess I am really dumb but its never clear to me how these different<br>&gt; methods are supposed to be used. I am not a trained OO programmer and find
<br>&gt; the documentation a little confusing (my problem :))<br>&gt;<br>&gt; So, I tried this:&nbsp;&nbsp; map.setBaseLayer(newBaseLayer)<br>&gt;<br>&gt; Where newBaseLayer is the name of the base layer set up at Load time.<br><br>
So, if you add two base layers to the map, then doing that should work.<br>I assume by &#39;name&#39; you mean &#39;variable name&#39;, rather than anything else.<br><br>If all else fails, looking at the code to the layerswitcher mouse
<br>handling methods might help you.<br><br>Regards,<br>--<br>Christopher Schmidt<br>MetaCarta<br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org">Users@openlayers.org
</a><br><a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a><br></blockquote></div><br>