PDA

View Full Version : A simple Action Script question...


ip076
01-14-2005, 03:37 PM
Hey all, I'm trying to make a cascading combo box. I have one combo box, and upon selecting an Item, I'd like to populate another combo box. If someone has a good link for me, I'll take it, I've searched this site and found some good stuff already, just wondering if anyone could mabye help out. Here is the code I'm using:

on (focusOut) {
if (_root.combobox1.text = "Weekday") {
_root.combo2.addItem ({label: "12:00", data: "12:00"});
_root.combo2.addItem ({label: "13:00", data: "13:00"});
} else {
_root.combo2.addItem ({label: "08:00", data: "08:00"});
_root.combo2.addItem ({label: "09:00", data: "09:00"});
}
}

Now I've realized that addItem might not be the best idea, because if you go back to the combo1, and click again, all it does is add the items, not replace them.

If anyone has an example, or can give me a little advice, I'd greatly appreciate it. Thanks!