PDA

View Full Version : Dynamic population of 2nd combo box


butterbur
12-05-2003, 04:05 PM
Hi peeps, hope I can get some help on this.
Using an example someone was kind enough to post I have two combo boxes on the stage, the first of which has an instance name of subjects_cb and has the following hard coded info:
labels: books, music, hardware
data: arbooks, armusic, arhardware

A second combo box on the stage, called details_cb, should have its contents changed using the following code:

arbooks=new Array("fiction","horror","non-fiction");
armusic=new Array("rock","country","pop");
arhardware=new Array("harddrive","cpu","memory");
subjects_cb.setChangeHandler("loadDetails");
loadDetails=function(){
var loadArray=subjects_cb.getSelectedItem().data;
details_cb.removeAll();
for(var i=0;i<this[loadArray].length;i++){
details_cb.addItem(this[loadArray][i],null);
}
};

Well as you can probably guess, it don't do it. Please have mercy on this old brain and point me in the right direction.:)

Regards to all.
BB

CyanBlue
12-05-2003, 05:43 PM
Hey, butterbur... ;)

Just out of curiosity... That bits of code... You said that's not working, right??? Is it not working because that's run in FMX2004??? I have run that code in FMX and it seemed like it is working as it should be... Or maybe I am missing something here??? :confused:

butterbur
12-05-2003, 06:04 PM
Hi Cyan (hope you're well),
Yeh I'm coding this in AS2 under mx2004/pro. I've looked at the changes and can't see what would cause this to fail.
Warm regards
BB

CyanBlue
12-05-2003, 06:20 PM
Hey... Thanks... ;)

Huh... That's really strange... I just opened the file in 2004 and I am getting undefined on the second combo box as soon as I export it to F7... But I have no way of helping you, my friend... This is my first time opening any file in FMX 2004... (I just installed it yesterday after I formatted the computer...)

Well... Good luck though... Hope you find the solution soon... ;)

butterbur
12-05-2003, 06:31 PM
Thanks for taking a look Cyan,
I tried it under mx and it works great (as you said it would). Perhaps I need to read some more.
All the best
BB