ActionScript 3.0 errors
Hello, I am new to ActionScript 3.0 and I do not understand the problem with my code. Can someone please correct it for me? Here are the errors: Expecting identifier before assign, Expecting rightparen before leftbrace, and Expecting rightparen before BMI.
// This line makes the button, btnDetermine wait for a mouse click
// When the button is clicked, the determineBMI function is called
btnDetermine.addEventListener(MouseEvent.CLICK, determineBMI);
// These lines make the textinput and the radioButtons wait for a mouse click
// When these components are clicked, the clearLabels function is called
RadioMetric.addEventListener(MouseEvent.CLICK, clearLabels);
RadioImperial.addEventListener(MouseEvent.CLICK, clearLabels);
// This line makes the textinput, txtinWeight and txtinHeight
(txtinWeight.addEventListener);
(txtinHeight.addEventListener);
// This is the determineBMI function
// e:MouseEvent is the click event experienced by the button
// void indicates that the function does not return a value
function determineBMI(e:MouseEvent):void
{
// declare the variables
var Weight:Number;
var Height:Number;
var BMI:Number;
var GMetric:String;
var GImperial:String;
// get the number from the user
Weight = Number(txtinWeight.text);
Height = Number(txtinHeight.text);
BMI = ( Weight / Height * Height || Weight * 703 / Height * Height )
// MetricGroup.group determines the group that GMetric is in
// ImperialGroup.group determines the group that GImperial is in
// .selectedData gets the value of the RadioButton that is selected from the group
GMetric = String(MetricGroup.group.selectedData);
GImperial = String(ImperialGroup.group.selectedData);
// determine the BMI
if (RadioMetric.Checked == true && BMI < 15 || BMI < 15 && RadioImperial.Checked == true)
{
lblStatement.text = "STARVATION: Consider gaining weight by eating healthy foods and building your muscles by strength training.";
}
else if (RadioMetric.Checked == true && BMI == 15 && =< 18.5 || RadioImperial.Checked == true && BMI == 15 && =< 18.5)
{
lblStatement.text = "UNDERWEIGHT: Consider eating nutrient-rich foods more frequently.";
}
else if (RadioMetric.Checked == true && BMI == 18.5 && =< 25 || RadioImperial.Checked == true && BMI == 18.5 && =< 25)
{
lblStatement.text = "IDEAL: Consider doing your habits on a regular basis to maintain your ideal body weight.";
}
else if (RadioMetric.Checked == true && BMI == 25 && =< 30 || RadioImperial.Checked == true && BMI == 25 && =< 30)
{
lblStatement.text = "OVERWEIGHT: Consider removing calories from your diet.";
}
else if (RadioMetric.Checked == true && BMI == 30 && =< 4 || RadioImperial.Checked == true BMI == 30 && =< 4)
{
lblStatement.text = "OBESE: Consider setting a goal of sow and steady weight loss and participate in safe weight-loss programs.";
}
else
{
lblStatement.text = "MORBIDLY OBESE: Consider talking to a physician or medical weight loss team for them to provide you with advice pertaining to your medical issues.";
}
}
// This is the clearLabels function
// e:MouseEvent is the click event experienced by the textinput
// void indicates that the function does not return a value
function clearLabels(e:MouseEvent):void
{
lblStatement.text = "";
lblBMI.text = "";
txtinWeight.text = "";
txtinHeight.text = "";
}
