Original User: rscheitlinAndrea, You are having an issue with trying to set the maps extent to a null extent because you are get one MapPoint back and MapPoints don't have an extent.Corrected code:
import com.esri.ags.geometry.MapPoint;
private function executeCompleteHandler(event:FindEvent):void
{
myGraphicsLayer.clear();
resultSummary.text = "Found " + event.findResults.length + " results.";
myGraphicsLayer.symbol = sfsFind;
var resultCount:int = event.findResults.length;
if (resultCount == 0)
{
Alert.show("No polling places found. Please change your search.");
}
else
{
// add feature as graphic to graphics layer
for (var i:int = 0; i < resultCount; i++)
{
var graphic:Graphic = FindResult(event.findResults).feature;
graphic.toolTip = event.findResults.foundFieldName + ": " + event.findResults.value;
myGraphicsLayer.add(graphic);
}
// zoom to extent of all features
var graphicProvider:ArrayCollection = myGraphicsLayer.graphicProvider as ArrayCollection;
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(graphicProvider.toArray());
if(graphicsExtent){
map.extent = graphicsExtent.expand(1.1); // zoom out a little
}else{
var gra:Graphic = FindResult(event.findResults[0]).feature;
if(gra.geometry is MapPoint){
map.centerAt(gra.geometry as MapPoint);
map.scale = 5000;
}
}
}
}