AnsweredAssumed Answered

cant add graphic to graphic layer user actionscript

Question asked by pvitt on Mar 5, 2012
Latest reply on Jun 28, 2012 by geospatialweb
I just cant seem to add a graphic to my graphic layer using actionscript --
I'm trying to add a point graphic where the user clicks the map -- this is what I have:

protected function MapClickHandler(event:MapMouseEvent):void
{
  const mapPoint:MapPoint = theMap.toMapFromStage(event.stageX, event.stageY);
  mapPoint.spatialReference = new SpatialReference(102100);
       
  var myGraphicMarker:Graphic = new Graphic(mapPoint,
  new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933));
    
  myGraphicMarker.toolTip = "Marker added with ActionScript";
  pointGraphicsLayer.add(myGraphicMarker);
  pointGraphicsLayer.refresh();
   
}

<esri:Map id="theMap"
   mapClick="MapClickHandler(event)">
<esri:GraphicsLayer id="pointGraphicsLayer">
</esri:Map>

I've confirmed that event.stageX and stageY are returning map coords by putting the results in a text box -- Any help on what I could be missing would be appreciated.

Thanks

Pete

Outcomes