AnsweredAssumed Answered

Proper use of  "setExtent()"

Question asked by mzuser01 on Jan 26, 2012
Latest reply on Jan 27, 2012 by mzuser01
Regarding the code at the bottom...

I am trying to change the map extent on the fly.

My map opens fine to an original extent.  I pan away a little bit.  I click a button to move it back to the original extent, but it never moves.

I know the function executes because I get the alert.

Also, when I run it with the last statement (which is commented out here) the map zooms, so I know the setExtent() method will at least work.

The wkid (102100) is used by the map server.

Am I misunderstanding the correct use of setExtent()?


 var contUnitedStatesExtent  = new esri.geometry.Extent({"xmin":-14327455,"ymin":3000000,"xmax":-8199999,"ymax":6000000,"spatialReference":{"wkid":102100}});  map1 = new esri.Map("mapDiv", {extent:contUnitedStatesExtent, wrapAround180:true});  basemap1 = new esri.layers.ArcGISTiledMapServiceLayer  ( "" );  map1.addLayer( basemap1 );   <!-- Change Extent --> function changeExtent () {      alert("Inside changeExtent()");         map1.setExtent(contUnitedStatesExtent, true);       //map1.setExtent(map1.extent.expand(0.5)); }