Hi,
In my query widget, I have a function to select feature on a layer. The selected feature will in special colour compare to other features in the same layer. But what I want is to display the selected feature in special colour only when the widget is opened. Any ideas.
My code for selecting feature as posted below:
var query:Query = new Query; | | | | | | | |
query.where = "POST_CODE LIKE '" + txt_PostCode.text + "'"; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
query.outSpatialReference = map.spatialReference;
query.returnGeometry=true; | | | | | | |
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(resultSet:FeatureSet, token:Object = null):void
{
graphicsLayer.clear();
if (resultSet.features.length == 0){
Alert.show("No feature returned, please try again.","ATTENTION");
}else{
var finalExtent:Extent;
var stGraphic:Graphic = resultSet.features[0];
finalExtent = Polyline(stGraphic.geometry).extent;
resultLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 0xFF0000, 0.7, 5);
graphicsLayer.symbol = resultLineSymbol;
for each (var graphic:Graphic in resultSet.features){
stGraphic = new Graphic(graphic.geometry);
graphicsLayer.add(graphic);
finalExtent = finalExtent.union(Polyline(graphic.geometry).extent);
}
map.extent = finalExtent;
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
Thank you.