private function drawEndHandler(event:DrawEvent):void { var extent:Extent = event.graphic.geometry as Extent; var graphic:Graphic; var results:ArrayCollection = new ArrayCollection; for (var i:Number = 0 ; i < myGraphicsLayer.numChildren ; i++) { graphic = myGraphicsLayer.getChildAt(i) as Graphic; //if point is contained within extent, highlight it and add for display in results list if (extent.contains(MapPoint(graphic.geometry))) { graphic.symbol = highlightedSymbol; results.addItem({CITY_NAME: graphic.attributes.CITY_NAME, STATE_NAME:graphic.attributes.STATE_NAME}); } //else if point was previously highlighted, reset its symbology else if (graphic.symbol == highlightedSymbol) { graphic.symbol = defaultSymbol; } } labelPoints.text = "# of points in extent = " + results.length; dg.visible = true; dg.dataProvider = results; }
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.