oh.
now that i've read your question a second time, i think i understand what you're asking.
what you need is a little function to loop through whatever array/object is set as the dataProvider for your combobox. and search for data that matches
n:
ActionScript Code:
// an array populated by an xml file. (populated by me for this example)
var dataArray = [
{ label:"Harry", data:123456 },
{ label:"Sally", data:123457 },
{ label:"Fred", data:123458 },
{ label:"Roxanne", data:123459 }
];
//
comboBox.dataProvider = dataArray;
//
// the data we want to search for.
var userDefinedVariable = 123459;
//
// set the selectedIndex to whatever the queryData function returns.
comboBox.selectedIndex = queryData( userDefinedVariable );
//
function queryData( query )
{
trace( "searching for:" + query + newline );
//
// loop through the array that provides the data to the combobox.
var l = dataArray.length;
for ( var i=0; i<l; i++ )
{
var trc = "[" + i + "] : " + dataArray[i].data;
// test for equality between the query parameter passed and the value of data for the current item.
// if the two match, return the value of i. which, in this example, will equal 3 which is the index of 123459.
if ( dataArray[i].data == query ) return i;
else trc += " > item not found.";
//
trace( trc );
}
// if the query value isn't found, default to something else ( in this case the first item).
return 0;
}
---
i should mention that the method i suggested in my earlier post is the component v1 way. if you're using v2 it would be:
ActionScript Code:
instanceNameOfComboBox.selectedIndex = 2;
all code in my example up top is the v2 method.