HI YungKai,
Script:
private function doFind1():void
{
findTask.execute(myFindParameters);
}
private function executeCompleteHandler1(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 parcels 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());
map.extent = graphicsExtent.expand(1.4); // zoom out a little
}
}
Declarations:
<esri:FindTask id="findTask2"
executeComplete="executeCompleteHandler1(event)"
url="**************"/>
<esri:FindParameters id="myFindParameters"
contains="true"
layerIds="[3]"
outSpatialReference="{map.spatialReference}"
returnGeometry="true"
searchFields="[SubName]"
searchText="{fText.text}"/>
Am I on the right track here or am I missing something?
Thanks,
Zlatko