var clickedGraphic:Graphic = new Graphic(); clickedGraphic = event.target as Graphic; trace("click: " + clickedGraphic.attributes.toString());
Solved! Go to Solution.
for each (var graphic:Graphic in featureSet.features) { graphic.toolTip = "Site ID: " + graphic.attributes["Site_ID"]; graphic.addEventListener(MouseEvent.ROLL_OVER, onMouseOver); //you could also add MouseEvent.CLICK graphic.id = "Dive"; }
private function onMouseOver(event:MouseEvent):void { var graphic:Graphic = Graphic(event.target); var objectid = graphic.attributes["OBJECTID"] //etc
for each (var graphic:Graphic in featureSet.features) { graphic.toolTip = "Site ID: " + graphic.attributes["Site_ID"]; graphic.addEventListener(MouseEvent.ROLL_OVER, onMouseOver); //you could also add MouseEvent.CLICK graphic.id = "Dive"; }
private function onMouseOver(event:MouseEvent):void { var graphic:Graphic = Graphic(event.target); var objectid = graphic.attributes["OBJECTID"] //etc
protected function onGraphicMouseClick(event:MouseEvent):void { var clickedGraphic:Graphic = Graphic(event.target); trace("event.target = " + event.target.toString()); }
TypeError: Error #1034: Type Coercion failed: cannot convert CompositeSymbolComponent@16e429e1 to com.esri.ags.Graphic.