private function executeCompleteHandler(event:FindEvent):void { myGraphicsLayer.clear(); resultSummary.text = "Found " + event.findResults.length + " results."; myGraphicsLayer.symbol = sfsFind; var resultCount:int = event.findResults.length; var graphic:Graphic; // check number of results if (resultCount == 0) { Alert.show("No Results Found."); } // for one point results else if (resultCount == 1) { graphic = event.findResults[0].feature; var mapPoint:MapPoint = MapPoint(graphic.geometry); graphic.symbol = sms; map.centerAt(mapPoint); map.scale = 1200; } // more than 1 point = MultiPoint else if (resultCount > 1) { // create a new MultiPoint to add all our point results to var multi:Multipoint = new Multipoint(); // add feature as graphic to graphics layer for (var i:Number = 0; i < resultCount; i++) { graphic = event.findResults.feature; graphic.toolTip = event.findResults.foundFieldName + ": " + event.findResults.value; var multiMapPoint:MapPoint = MapPoint(graphic.geometry); multi.addPoint(multiMapPoint); myGraphicsLayer.add(graphic); } // zoom to extent of the multipoint var nExt:Extent = multi.extent.expand(1.25); map.extent = nExt; } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.