View Full Version : Combo Box poulate another
pixcels
12-14-2004, 09:53 PM
Is there a way that a combo box can see the selected item of another combo box and select new data depending on the other combo box. I think this is done through data binding but I am not sure.
firdosh
01-06-2005, 03:55 PM
In this example whatever you select in the first comboBox gets added to the second.
Hope this is what you were looking for
import mx.controls.ComboBox;
var myComboBox1:ComboBox=createClassObject(ComboBox,"myComboBox1",0);
var myComboBox2:ComboBox=createClassObject(ComboBox,"myComboBox2",1);
var count:Number=0;
myComboBox1.addItem("item"+count,"item"+count++);
myComboBox1.addItem("item"+count,"item"+count++);
myComboBox1.addItem("item"+count,"item"+count++);
myComboBox1.addEventListener("change",onChange);
myComboBox2._y=myComboBox1._y+myComboBox1._height+ 10;
function onChange(event_obj:Object):Void{
trace(myComboBox1.selectedItem.label);
myComboBox2.addItem(myComboBox1.selectedItem.label );
}
cheers
Firdosh :)
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.