Original example URL: http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html
I changed the code as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <s: Application xmlns: S = "Library: // ns.adobe.com/flex/spark" <br/> xmlns: FX = "http://ns.adobe.com/mxml/2009" <br/> xmlns: MX = "Library: // ns.adobe.com/flex/mx" <br/> xmlns: ESRI = "http://www.esri.com/2008/ags" <br/> pagetitle = "Query Task (with a map) "<br/> </P> <p> <FX: SCRIPT> <br/> <! -- [CDATA [<br/> Import COM. ESRI. AGS. graphic; <br/> Import COM. ESRI. AGS. featureset; <br/> Import MX. controls. alert; <br/> Import MX. RPC. asyncresponder; <br/> private function doquery (): void <br/>{< br/> querytask.exe cute (query, new asyncresponder (onresult, onfault )); <br/> function onresult (featureset: featureset, Token: Object = NULL): void <br/>{< br/> // No code needed in this simple sample, since the <br/> // graphiclayer is bound to the query result using <br/> // graphicprovider = "invalid querytask.exe cutelstresult. features} "<br/>}< br/> function onfault (Info: object, Token: Object = NULL): void <br/>{< br/> alert. show (info. tostring (), "query problem"); <br/>}< br/>] --> <br/> </FX: SCRIPT> <br/> <FX: declarations> <br/> <ESRI: querytask id = "querytask" showbusycursor = "true" <br/> url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"/> <br/> <ESRI: query ID = "query" text = "{qtext. text} "returngeometry =" true "outspatialreference =" {map. spatialreference} "> <br/> <ESRI: outfields> <br/> <FX: String> med_age </FX: String> <br/> <FX: string> pop2007 </FX: String> <br/> </ESRI: outfields> <br/> </ESRI: Query> <br/> </FX: declarations> <br/> <mx: panel title = "query a layer (search for a State) "layout =" horizontal "<br/> backgroundcolor =" 0xb2bfc6 "borderstyle =" solid "> <br/> <mx: textinput width = "100%" id = "qtext" Enter = "doquery ()" text = "California"/> <br/> <mx: button label = "do query" Click = "doquery ()"/> <br/> </MX: Panel> <br/> <ESRI: map id = "map"> <br/> <ESRI: extent> <br/> <ESRI: extent xmin = "-170" ymin = "15" xmax = "-65" Ymax = "75"> <br/> <ESRI: spatialreference wkid = "4326"/> <br/> </ESRI: extent> <br/> <ESRI: arcgistiledmapservicelayer <br/> url = "http://server.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer"/> <br/> <ESRI: graphicslayer id = "mygraphicslayer" graphicprovider = "{querytask.exe cutelstresult. features} "/> <br/> </ESRI: Map> <br/> </S: Application>
When browsing, you can find that the query window is on the next layer of the map. The map is displayed, but you cannot query it ......
Modifying ......