PDA

View Full Version : Dynamic Combo Box not remembering selected


mattd
05-29-2006, 09:36 PM
Using amfphp I have my remote connector returning an array of values for my combo box. It works as expected and creates an instance of a combo box on the stage and populates it with the array from amfphp. The problem is that when I select any of the options in the combo box it always defaults to the first item. The second time I click the combo box the only option available is the first option in my array. That is if I had options a,b,c,d,e and I selected d the combo box would show a as selected and only show a,a,a,a,a as options the second time I cilck the drop down. The third time I click the combo box I have a,a,a,a,a and all are high lighted green as selected. The following code creates the the combo box and adds the items at run time. The trace always comes up showing the first item in the array. Any help or direction is appreicates.


var scenarioList:ComboBox = attachMovie("ComboBox", "scenarioList", this.getNextHighestDepth());
scenarioList.addItem('2222','2');
scenarioList.addItem('3333','3');
scenarioList.addItem('1111','1');
scenarioList.addItem('4444','4');
scenarioList.addItem('5555','5');

var cbListener:Object = new Object();
cbListener.change = function (evt_obj:Object) {
trace("Currently selected item is: " + evt_obj.target.selectedItem);
}
//Add Listener
scenarioList.addEventListener("change", cbListener);

Xeef
05-29-2006, 11:00 PM
and how doest the actual code looks
wich isn't working ?

eg the variable you use and theyr type and value