Hello
I am trying to get a stupid combo box to work in flash cs3. All i want to do is have a couple of combo boxes which when i select an option it then performs a calculation.
i.e
Combo 1 = Age
10 - 15
Combo 2 = Gender
Male
The formula
If (Combo 1 == "10 - 15" && Combo 2 = "Male"){
answer.text = 10*10;
}
I have managed to create a combo box which when i select the Gender i can get the answer.text to show Male or Female, but i can not get the formula to work and then when i add a second combo box the who .
fla comes up with errors.
Before in Action script 2 i can easily do formulas i.e
var cal:Number=Number(10*10);
var sum=cal;
but i want to use Action script 3.
Does anyone know where i can find a tutorial which uses a combo box to do a formula or can any one assist?
Here is the code i am using at the moment:
import fl.controls.ComboBox;
import fl.data.DataProvider;
var sGender:Array = new Array(
{label:"Male",
data:"Male"},
{label:"Female",
data:"Female"}
);
var aCb:ComboBox = new ComboBox();
aCb.dropdownWidth = 100;
aCb.width = 100;
aCb.move(208, 46);
aCb.prompt = "Gender";
aCb.dataProvider = new DataProvider(sGender);
aCb.addEventListener(Event.CHANGE, changeHandler);
addChild(aCb);
function changeHandler(event:Event):void {
if(aCb.value =="Male"){
txttest.text="Male" ;
}
if(aCb.value =="Female"){
txttest.text="Female";
}
}