When you make a query request to the server, you have to wait for the results to come(unless you are binding the executelastresult to a component). This can be achieved by either:1.Using Responder sample for using the same is at: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=QueryResultsWithChart2. Adding executeComplete event listener to querytask and in event handler perform rest of your steps: i.e.var num:int = queryTask.executeLastResult.features.length; Alert.show(num.toString()); if ( num != 1){ Alert.show("All stops must be located inside Philadelphia County"); return; } var point:MapPoint = event.mapPoint; var myGraphicMarker:Graphic = new Graphic(point,userMarks); myGraphicMarker.toolTip = "Added stop"; userClicks.add(myGraphicMarker); stops.push(myGraphicMarker); messages.text = stops.length.toString() + " total stops"
var num:int = queryTask.executeLastResult.features.length; Alert.show(num.toString()); if ( num != 1){ Alert.show("All stops must be located inside Philadelphia County"); return; } var point:MapPoint = event.mapPoint; var myGraphicMarker:Graphic = new Graphic(point,userMarks); myGraphicMarker.toolTip = "Added stop"; userClicks.add(myGraphicMarker); stops.push(myGraphicMarker); messages.text = stops.length.toString() + " total stops"
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.