PDA

View Full Version : Simple combobox databinding question


rattleheadmegafan
06-27-2008, 06:10 PM
Hi,

I have an editable combobox cmbTest with values "a", "b" and "c"
In my actionscript procedure, I am dynamically changing it's set of values to "d", "e" and "f". But since it's an editable dropdown, I want the default value to be "z" with the selectable options as "d", "e" and "f". To do this, i'm doing the following from my AS code:

var ml:Array = new Array("d","e","f");
cmbTest.dataProvider = ml;
cmbTest.text = "z";

And it doesn't seem to work. Any help would be appreciated.

TIA!

coolaj86
06-30-2008, 04:27 PM
For your application is it reasonable to do this?

ml.add("z")
cmbTest.dataProvider = {ml}
cmbTest.selectedIndex = ml.indexOf("z")

p.s. The red button on the right of the toolbar allows you to wrap code as actionscript.

rattleheadmegafan
06-30-2008, 06:26 PM
Great solution. Works best for me. Thanks!