Mads, I am not real sure if this has it or not, but this seems to be working for me. //this function called when the widget's configuration is loaded
private function init():void
{
if (configXML) // checking for valid content in the configuration file
{
promptString = configXML.promptlabel || "SuperSearch";
matchTypeString = configXML.matchtype || "anyPart";
styleNameString = configXML.stylename || "underline";
dropDownRows = configXML.dropdownrows || 10;
dropDownListWidth = configXML.dropdownlistwidth || 250;
checkSearchResult = configXML.checksearchresult;
}
// setting the properties of the advancedAutocompleteDropdown
acAdv.prompt = promptString;
acAdv.matchType = matchTypeString;
acAdv.dropDownRowCount = dropDownRows;
// setting the dropdownwidth to a minimum of 250
if (dropDownListWidth < 250){
acAdv.dropDownWidth = 250;
}
else{
acAdv.dropDownWidth = dropDownListWidth;
}
// setting the dropdownrowcount to a max of 10
if (dropDownRows > 10){
acAdv.dropDownRowCount = 10;
}
else{
acAdv.dropDownRowCount = dropDownRows;
}
var lyrList:XMLList = configXML..layer;
for (var i:int = 0; i < lyrList.length(); i++)
{
layerURL = lyrList.layerurl;
layerOutField = lyrList.layeroutfield;
layerZoomScale = lyrList.layerzoomscale;
var comboQueryTask:QueryTask = new QueryTask();
comboQueryTask.url = layerURL;
comboQueryTask.useAMF = false;
var comboQuery:Query = new Query();
comboQuery.returnGeometry = true;
comboQuery.where = "1=1";
comboQuery.outFields = [layerOutField];
comboQuery.outSpatialReference = map.spatialReference;
comboQueryTask.execute(comboQuery, new AsyncResponder(onQueryComplete,onFault,layerOutField));
function onQueryComplete(featureSet:FeatureSet, token:String = null):void
{
for each (var graphic:Graphic in featureSet.features)
{
var fieldValue:String = graphic.attributes[token].toString();
results.addItem({label: fieldValue, data: graphic});
}
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
commExtent = graphicsExtent;
}
//on fault
function onFault(info:Object, token:Object = null):void
{
trace(info.toString());
}
}
acAdv.dataProvider = results;
// 12-01-2011 adding graphics layer
// markersymbol
const resultMarkerSymbolStyle:String = configXML.symbols.point.style || 'diamond';
const resultMarkerSymbolSize:Number = configXML.symbols.point.size || 15;
const resultMarkerSymbolColor:uint = configXML.symbols.point.color || 0xFF0000;
const resultMarkerSymbolAlpha:Number = configXML.symbols.point.alpha || 0.5;
resultMarkerSymbol = new SimpleMarkerSymbol(resultMarkerSymbolStyle, resultMarkerSymbolSize, resultMarkerSymbolColor, resultMarkerSymbolAlpha);
// linesymbol
const resultLineSymbolStyle:String = configXML.symbols.line.style || 'solid';
const resultLineSymbolWidth:Number = configXML.symbols.line.width || 2;
const resultLineSymbolColor:uint = configXML.symbols.line.color || 0xFF0000;
const resultLineSymbolAlpha:Number = configXML.symbols.line.alpha || 0.5;
resultLineSymbol = new SimpleLineSymbol(resultLineSymbolStyle, resultLineSymbolColor, resultLineSymbolAlpha, resultLineSymbolWidth);
//fillsymbol
const resultFillSymbolStyle:String = configXML.symbols.polygon.style || 'solid';
const resultFillSymbolColor:uint = configXML.symbols.polygon.color || 0xFF0000;
const resultFillSymbolAlpha:Number = configXML.symbols.polygon.alpha || 0.5;
const resultFillSymbolOutlineStyle:String = configXML.symbols.polygon.outlinestyle || 'solid';
const resultFillSymbolOutlineColor:uint = configXML.symbols.polygon.outlinecolor || 0x000000;
const resultFillSymbolOutlineAlpha:Number = configXML.symbols.polygon.outlinealpha || 1;
const resultFillSymbolOutlineWidth:Number = configXML.symbols.polygon.outlinewidth || 1;
resultFillSymbol = new SimpleFillSymbol(resultFillSymbolStyle, resultFillSymbolColor, resultFillSymbolAlpha, new SimpleLineSymbol(resultFillSymbolOutlineStyle, resultFillSymbolOutlineColor, resultFillSymbolOutlineAlpha, resultFillSymbolOutlineWidth));
graphicsLayer = new GraphicsLayer();
graphicsLayer.name = "acAdv Results";
graphicsLayer.symbol = resultMarkerSymbol;
map.addLayer(graphicsLayer);
}
just delete your existing onQueryComplete function