Hi … can anyone have a look at this and tell me why this might not be working ?
I just want it to go to macromedia url when select State1City1
import mx.controls.ComboBox
// Create the combo boxes
var cb1:ComboBox = createClassObject (ComboBox, “cb1”, 1);
var cb2:ComboBox = createClassObject (ComboBox, “cb2”, 2);
// Position the second one so it doesn’t overlap the first one
cb2.move (125, 0);
// Set the dataProvider for cb1
cb1.dataProvider = [{label:“state 1”}, {label:“state 2”}, {label:“state 3”}];
// Arrays containing the cities for a particular state
var cities1:Array = [{label:“state 1 city 1”,data:“1”}, {label:“state 1 city 2”}, {label:“state 1 city 3”}];
var cities2:Array = [{label:“state 2 city 1”}, {label:“state 2 city 2”}, {label:“state 2 city 3”}];
var cities3:Array = [{label:“state 3 city 1”}, {label:“state 3 city 2”}, {label:“state 3 city 3”}];
// Set the onState method to execute when the cb1 combo box is changed
cb1.addEventListener (“change”, onState);
// The method executed when cb1 is changed
function onState (event:Object):Void
{
var cb:ComboBox = event.target;
var state:String = cb.selectedItem.label;
// Sets the city combo box depending on the state picked
switch (state)
{
case “state 1” :
cb2.dataProvider = cities1;
break;
case “state 2” :
cb2.dataProvider = cities2;
break;
case “state 3” :
cb2.dataProvider = cities3;
break;
}
}
// Set the onCity method to execute when the cb2 combo box is changed
cb2.addEventListener (“change”, onCity);
// The method executed when cb2 is changed
function onCity (event:Object):Void
{
var cb:ComboBox = event.target;
var swf:String = cb.selectedItem.data;
}
{
switch(swf)
{
case “1” :
getURL(“http://www.macromedia.com/”);
break;
}
}