Hey there, I was wondering how to cancel an asynchronous call? It displays the correct results that I'm looking for; however, when I click my cancel button halfway through the loading process, I don't want it to return anything after that. So far I only have a cancel button that clears the graphics from the map, but then they redisplay once the execution is complete. Is there a method I can use to prevent this? Thanks in advance.if(driveTimes.length){
var params:Object =
{
//Async params
"SDESQL_SDE_inPoints_NAD83": featureSet,
"Impedance_attribute": impedanceAttr,
"Default_break_values": driveTimes
};
serviceAreaService.outSpatialReference = map.spatialReference;
serviceAreaService.submitJob(params, new AsyncResponder(submitComplete, onFault), new AsyncResponder(submitStatus, onFault));
showMessage("loading", true);
function submitStatus(gpStatus:JobInfo, token:Object = null):void
{
// showMessage(loadingLabel, true);
showMessage("Asynchronous", true);
}
function submitComplete(gpResult:JobInfo, token:Object = null):void
{
serviceAreaService.getResultData(gpResult.jobId, "serviceArea_shp", new AsyncResponder(submitResult, onFault));
}
function submitResult(pv:ParameterValue, token:Object = null):void
{
var fs:FeatureSet = pv.value as FeatureSet;
var symRenderer:UniqueValueRenderer = new UniqueValueRenderer();
symRenderer.attribute = "ToBreak";
symRenderer.defaultSymbol = fillSym3;
var symRendererInfos:Array = new Array();
symRendererInfos.push(new UniqueValueInfo(fillSym1, numTime1.value.toString()));
symRendererInfos.push(new UniqueValueInfo(fillSym2, numTime2.value.toString()));
symRenderer.infos = symRendererInfos;
graphicsLayer.renderer = symRenderer;
graphicsLayer.graphicProvider = fs.features;
graphicsLayer.add(graphic);
map.extent = getFeatureSetExtent(fs);
clearMessage();
}
function onFault(info:Object, token:Object = null):void
{
showMessage(info.toString(), false);
}