vosgien
11-04-2002, 06:50 AM
Hi,
I feel bit awkward asking this Q. Why ? Well I've done quite an extensive search on this forum and it seems there are a million and one Q.'s re the comboBox, I am beginning to think this component is not so good. I have also spent time at MM and in F1, so maybe it is just a small piece of code and I can't see the wood for the trees!!
Basically I have a combo box on stage and when user clicks on the drop down a dynamic text box is populated with the users choice. Using this code :
//this fills the comboBox list
sex = new Array("Sex", "Female", "Male");
//
for(i=0;i<sex.length;i++){
sexBox.addItem(sex[i]);
}
//
//this fills the text box sexSelect
sexBox.setChangeHandler("onItemPicked");
onItemPicked=function(){
sexSelect = (sexBox.getSelectedItem().label);
}
Now, that works absolutely fine, no probs........ except when I put a second comboBox on stage using this code :
ages = new Array("Age group","18 -25","26 - 35", "36 - 45","46 - 55", "over 55");
//
for (i=0;i<ages.length;i++){
ageGroup.addItem(ages[i]);
}
//
ageGroup.setChangeHandler("onItemPicked");
//
onItemPicked = function(){
ageSelect=(ageGroup.getSelectedItem().label);
}
The first dynamic text box, and I assume the first changeHandler are completely ignored.
I have tried many different ways of doing this but it don't happen.
Anyways, I have posted a testfile for anyone who has the time to look, but it is doin' my 'ed IN
Cheers
Vosgien
I feel bit awkward asking this Q. Why ? Well I've done quite an extensive search on this forum and it seems there are a million and one Q.'s re the comboBox, I am beginning to think this component is not so good. I have also spent time at MM and in F1, so maybe it is just a small piece of code and I can't see the wood for the trees!!
Basically I have a combo box on stage and when user clicks on the drop down a dynamic text box is populated with the users choice. Using this code :
//this fills the comboBox list
sex = new Array("Sex", "Female", "Male");
//
for(i=0;i<sex.length;i++){
sexBox.addItem(sex[i]);
}
//
//this fills the text box sexSelect
sexBox.setChangeHandler("onItemPicked");
onItemPicked=function(){
sexSelect = (sexBox.getSelectedItem().label);
}
Now, that works absolutely fine, no probs........ except when I put a second comboBox on stage using this code :
ages = new Array("Age group","18 -25","26 - 35", "36 - 45","46 - 55", "over 55");
//
for (i=0;i<ages.length;i++){
ageGroup.addItem(ages[i]);
}
//
ageGroup.setChangeHandler("onItemPicked");
//
onItemPicked = function(){
ageSelect=(ageGroup.getSelectedItem().label);
}
The first dynamic text box, and I assume the first changeHandler are completely ignored.
I have tried many different ways of doing this but it don't happen.
Anyways, I have posted a testfile for anyone who has the time to look, but it is doin' my 'ed IN
Cheers
Vosgien