AnsweredAssumed Answered

Graphic onClick event handler

Question asked by seth.ellingson on Aug 10, 2012
Latest reply on Aug 13, 2012 by seth.ellingson
This seems like a very simple request, I want to add an individual listener for several graphics(unknown number) that are displayed on the same graphics layer.  I'm pretty new to the ESRI javascript api, but you would think that this would be simple.

To start, I am querying a rest api that returns the coordinates of the graphics I want to display.  I have no problem displaying the graphic, but can't add a listener.  Here's what I have:

polygon[id] = new esri.geometry.Polygon(new esri.SpatialReference({wkid:4326})); polygon[id].addRing(ring); var symbol = new esri.symbol.SimpleFillSymbol(); footprint[id] = new esri.Graphic(polygon[id], symbol); footprintLayer.add(footprint[id]);  dojo.connect(footprint[id], "onClick", function(evt) {      alert('It works'); });


This is currently showing a polygon, but will be replaced with a geo-referenced image.

I must be missing something, because this is very easy to do with the flex api. Any help would be appreciated!

Outcomes