Hi, i have the following piece of code to perform a buffer operation after an onclick event on a button component, but for some reason the Buffer only gets produced after the second click.
function doBuffer(geometryToBuffer)
{
var params = new esri.tasks.BufferParameters();
params.geometries = [geometryToBuffer];
params.distances = [5,15];
params.unit = esri.tasks.GeometryService.UNIT_KILOMETER;
params.outSpatialReference = map.spatialReference;
gsvc.buffer(params, showBuffer);
}
function showBuffer(geometries)
{
var symbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([0, 0, 255, 0.65]), 2
),
new dojo.Color([0, 0, 255, 0.35])
);
dojo.forEach(geometries, function (geometry) {
var graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
});
}