This content has been marked as final. Show 3 replies
are you using equal signs when you are referring to the combobox.value? if so you need a double equals: ==
if not, im not sure what to tell you :\
hope this helps
Well, that's the point - I *do* want to set the value. Here's the code I'm trying to optimize:
var locationID:int = int(Application.application.parameters.locationID);
for(var i:int = 0; i < aLocation.length; i++)
if(aLocation .LocationID == locationID)
cmbCenter.selectedIndex = i;
It just seems like it should be possible to set this value with a single statement, e.g.
cmbCenter.value = 22; //or whatever
Honestly, there is no better way to do this. The items are stored in a linear list and not sorted in any way. The only algorithm for this is a linear search. And don't think that setting selectedItem is any better--the combobox does a linear search to find a match. The rationale here is that the number of items in a combobox is typically small (a dozen or less, perhaps). Any solution more complex is simply over-engineering.