var clickedGraphic:Graphic = new Graphic(); clickedGraphic = event.target as Graphic; trace("click: " + clickedGraphic.attributes.toString());
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.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.