<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19120"></HEAD>
<BODY>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=488330402-20092011>I am
trying to set the base layer inside a function like this</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=488330402-20092011></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=488330402-20092011>function switchbaselayer(newname)
{<BR> var thelayer =
newname;<BR> var thenewbase =
mapPanel.map.getLayersByName(thelayer);<BR> mapPanel.map.setBaseLayer(thenewbase);<BR>
mapPanel.map.baseLayer.setVisibility(true);</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=488330402-20092011>}</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2 face=Arial>The
cods seems to run through without any errors, however the base layer is not
switched and the map not updated ( I can see that the layer object is found in
getLayersByName). </FONT></SPAN></DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2 face=Arial>and in
Firebug</FONT></SPAN></DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2
face=Arial>mapPanel.map.baseLayer.name; </FONT></SPAN></DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2 face=Arial>prints
the previous/old baselayers name </FONT></SPAN></DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2 face=Arial>What
am I doing wrong ?</FONT></SPAN></DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=488330402-20092011><FONT color=#000080 size=2
face=Arial>Cheers</FONT></SPAN></DIV>
<DIV><FONT size=2><SPAN style="FONT-FAMILY: Verdana; FONT-SIZE: 11pt">Karsten
</SPAN></FONT></DIV></BODY></HTML>