jhanderson

map.setExtent problem

Discussion created by jhanderson on Oct 31, 2011
Latest reply on Nov 1, 2011 by DSwingley-esristaff
I'm running into the following issue, and would be very appreciative if someone can help out.
Code is as follows:

  var map;
       
        function Init() {
   
            map = new esri.Map("mapDiv");
            newMap = new esri.layers.ArcGISDynamicMapServiceLayer("http://devone/ArcGIS/rest/services/lxvi/MapServer/");
           
            map.addLayer(newMap);          

        }

        function myzoom() {
            var axtent = new esri.geometry.Extent(6008950, 2066586, 6008550, 2066186, new esri.SpatialReference({ "wkid": 2227 }));
            map.setExtent(axtent);

        }


I'm simply trying to let the user zoom to a specific area on my map by clicking on a button that calls the 'myzoom' function. The first time the button is clicked the correct (intended) extent is displayed.  However, clicking the button again shifts the map noticeably to the left ("extent B").
Click again, map remains at "Extent B".  Zoom in, pan around,etc. then click the button invoking "my zoom" and erroneous "Extent B" is still shown.  I've tried multiple map services, and different versions of the api, and still running into the same problem.  I really am stuck, and any thoughts would be awesome.

thanks,
Justin

Outcomes