I would like to have a combobox use a graphic's geometry as it's value. I don't know if this is even possible, and I can't find anything definitive on the subject. I'm hoping some of the geniuses here can shed some light on the subject.Right now I have a combobox that I have populated from an array collection built by a querytask response. Technically it is 4 querytask responses in array collections that are merged into a single array collection when all the tokens light up true. Then this single array collection is assigned as the dataprovider for the combobox. I'm setting up the collection in this manner: collection.addItem({label:fieldValue, data:graphic.geometry}) // where field value is a stringand then assigning it like this after concatenating the collections:cmb1.labelField = "label";cmb1.dataProvider = mergedCollection; // where mergedCollection is a concatenation of collections as created aboveThe problem is that when I then select an item from the seemingly populated combobox and submit the query I get the following:[RPC Fault faultString="Unable to complete operation." faultCode="400" faultDetail="'where' parameter not specified'objectIds' parameter not specified'time' parameter not specified'geometry' parameter not specified'text' parameter not specifiedUnable to complete Query operation."]Here is a sample of my code. The whole process of populating the combobox starts in initCombo(). Hopefully you can follow it from there. I also included doQuery() which is called from a button after the user picks something from the combobox.
private function initCombo():void
{
var baseURL:String = "http://myserver/ArcGIS/rest/services/mystuff/MapServer/"
var tokenCounter:int = 0;
// tokens is an array collection of objects
// only feature layers 7 to 10 are relevant for this combobox
for (var i:int = 7; i < 11; i++) {
queryTask.url = baseURL + i.toString();
queryTask.execute(query, new AsyncResponder(onResult, onFault, tokens.getItemAt(tokenCounter)));
tokenCounter++;
}
function onResult(featureSet:FeatureSet, token:Object = null):void
{
for each (var graphic:Graphic in featureSet.features)
{
var fieldValue:String = token.name + " " + graphic.attributes["OBJECTID_1"].toString();
token.collection.addItem({label:fieldValue, data:graphic.geometry});
}
for each (var item:Object in tokens)
{
// probably a better way to get a handle back to global collections than this
if (item.name == token.name)
{
item.collection = token.collection;
item.completed = true;
break;
}
}
// if all the tokens are true, merge the collections into one
if (checkTokens()){
// collections is an array containing the array collections so I can iterate through them
for (var i:int = 0; i < collections.length; i++)
{
mergedCollection = new ArrayCollection(result.source.concat(collections.source));
}
cmb1.labelField = "label";
cmb1.dataProvider = mergedCollection;
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
private function checkTokens():Boolean
{
for (var i:int = 0; i < tokens.length; i++)
{
if (!(tokens.completed))
{
return false;
}
}
return true;
}
private function doQuery():void
{
graphicsLayer.clear();
query.where = "";
// I thought this would be the geometry returned by the query
query.geometry = cmb1.selectedItem.value;
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
map.extent = graphicsExtent;
}
graphicsLayer.graphicProvider = featureSet.features;
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
This is the MXML for my combobox:<s:ComboBox id="cmb1" x="179" y="205" labelField=""/>Any help would be greatly appreciated.Thanks,Aaron