PDA

View Full Version : combox box - load variable


bibbs
09-25-2002, 03:26 PM
I'm working on a project that requires contact details to be listed for different clubs. I thought the best way to do this was to have the club names in a combo box, which can be selected, then the contact details for that club could then be loaded with loadVariables command via a txt file.

I've tried many different code variations, and nothing is working yet. Can anyone help on this. This is what I have so far is

function onSelect1() {
onSelect1 = combobox.getSelectedItem().label;
if (onSelect1 == "clubA") {
loadVariablesNum("clubA.txt", 1);
} else if (onSelect1 == "clubB") {
loadVariablesNum("clubB.txt", 1);
}
}

The dynamic text field has been set as multiline (without wrap), the variable name is myContact. The handler on the combo box is called onSelect1

Does it matter that multiple txt files can be loaded into the same text field with the same variable name?

tg
09-25-2002, 03:41 PM
welcome to as[org]. please remember to search.
i posted this earlier today:
http://www.actionscripts.org/forums/showthread.php3?s=&threadid=16389

just put your load actions inside the changehandler where i have the trace statements.

bibbs
09-25-2002, 04:00 PM
I did read that post but couldn't get it to work. I obviously haven't got it right now either. The script I have now is corrupt and is followed.

club_select.setChangeHandler=function("getPick");
function getPick(club_select){
trace(club_select.getSelectedItem().label;
trace(club_select.getSelectedItem().data;
if (onSelect1 == "Coolbinia-West Perth") {
loadVariablesNum("coolbinia.txt", 1);
} else if (onSelect1 == "Ascot") {
loadVariablesNum("ascot.txt", 1);
}

}


Can someone tell me whats wrong

tg
09-25-2002, 04:32 PM
if (club_select.getSelectedItem().label == "Coolbinia-West Perth") {
loadVariablesNum("coolbinia.txt", 1);
} else if (club_select.getSelectedItem().label == "Ascot") {
loadVariablesNum("ascot.txt", 1);


don't know if your check the label or data of the combobox, so you may need to change this code to reflect the correct choice.

bibbs
09-25-2002, 04:51 PM
i've tried this and no good either.

If someone could set up a simple example of how this works and post the fla in a zip. I may be able to understand what has to happen in my example.

I am totally confused. Too much new code that I don't fully understand.

Hope someone can help.