# Action script, need expert help with combo box!

**URL:** <https://forum.kirupa.com/t/action-script-need-expert-help-with-combo-box/127808>\
**Category:** Uncategorized\
**Created:** [November 6, 2004, 5:47pm UTC](https://forum.kirupa.com/t/action-script-need-expert-help-with-combo-box/127808 "2004-11-06T17:47:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wilfolaram](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@wilfolaram](https://forum.kirupa.com/u/wilfolaram)\
**Post date:** [November 6, 2004, 5:47pm UTC](https://forum.kirupa.com/t/action-script-need-expert-help-with-combo-box/127808/1 "2004-11-06T17:47:22Z")

</div>

[color=black][font=Verdana]The thing is, when I added a third combo box I got undesirable results. Here is the script:

cars = [“Ford”, “Fiat”];

Ford = [“green”, “yellow”];  
Fiat = [“red”, “white”];

green = [“2002”, “2003”, “2004”];  
yellow = [“2005”, “2006”, “2007”];  
red = [“2008”, “2009”];  
white = [“2009”, “2010”];

myCars.setDataProvider(cars);  
myColors.setDataProvider(Ford);  
myYears.setDataProvider(green);

listener = {}  
listener.ref = this  
listener.change=function(evt){  
var choice = evt.target.selectedItem;  
myColors.setDataProvider(this.ref[choice])  
}  
myCars.addEventListener(“change”, listener)

listener = {}  
listener.ref = this  
listener.change=function(evt){  
var choice = evt.target.selectedItem;  
myYears.setDataProvider(this.ref[choice])  
}  
myColors.addEventListener(“change”, listener)

As you can see I gave the third combo box an instance name of myYears.  
When I select fiat in the first combo box, red displays in the second combo box, but the correct years do not display in the third combo box until I reselect red in the second combo box. Why ?[/font][/color]
