AnsweredAssumed Answered

Graphics Draw, map.graphics.clear(), AMD Map navigation not enabled.

Question asked by AndyMan on Jul 2, 2014
Latest reply on Jul 3, 2014 by jeff.pace
Hi,

My question is:  Why does my map freeze and then return an undefined geometry error?  is there a way I can get around it?

Using the sample code for drawing and the graphics draw toolbar:

http://developers.arcgis.com/javascript/samples/graphics_add/

There is no button for clearing the graphics.  I wanted to wire up a button (

<input type="submit" value="Clear Map" />  ready(function(){      query("input[type=\"submit\"]").on("click",clearMap);  });  function clearMap(){                    try{          map.graphics.clear();                                                 }          catch(e){              alert("something went wrong in the clear map function");         }        }  


to fire off and then clear the map. 

I've been having some trouble coming up to speed on the AMD method for the new way to write javascript.  I found a really good example fiddle here:  http://jsfiddle.net/g00glen00b/tLN5b/ that gave me some insight that I needed.

So.. I can now call a function from a click event and clear the map.  However, then the map freezes and I get an undefined geometry error.

Does anyone see something?, or is there a better way?

Andy

Outcomes