<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I have a TMS layer that I'm using as my map, i have set it up so that 
users can change the map
however changing the layer does not update the map view until i hit the 
zoom in button or the zoom out button. how can i refresh the map view to
 show the newly added layer?
here is a quick code sample. i tried layer.redraw() without any 
solution. does someone have any other ideas.<span class="comment-copy">on a desperate  i just try setting the map div html to "" and it 
finally updated the layer. is this the proper way to do this?</span><br><br>[code sample below]<br><pre><code>function initMAP() {
    var mapBounds = new OpenLayers.Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
    var mapMinZoom = 0;
    var mapMaxZoom = 3;

    // avoid pink tiles
    OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
    OpenLayers.Util.onImageLoadErrorColor = "transparent";




    var options = {
        theme: null,
        controls: [

        new OpenLayers.Control.Navigation({
            dragPanOptions: {
                //     enableKinetic: true
            }
        }),
        new OpenLayers.Control.Attribution(),
        new OpenLayers.Control.Zoom()
        ],

        maxExtent: new OpenLayers.Bounds(bounds[0], bounds[1], bounds[2], bounds[3]),
        maxResolution: 4,
        numZoomLevels: 3

    };


    map = new OpenLayers.Map('map', options);

      layer = new OpenLayers.Layer.TMS("TMS", "http://mymapserver.com/MAP2/", { 'type': 'png', 'getURL': get_my_url });


      map.addLayer(layer);
      layer.redraw({ force: true });

      map.zoomToExtent(mapBounds);

    new OpenLayers.Control.Attribution(),
    new OpenLayers.Control.Zoom()

}<br><br></code>
<br></pre><br>                                          </div></body>
</html>