You can look into the Analysis tools available in an organizational account for ArcGIS Online. Alternatively, if you have ArcGIS Server, you can create a geoprocessing service that will accept a text input, make some attribute selections, then some location selections to return the associated polygon. You can then use the Flex Viewer and add any services you have running to the application.