Я новичок в ActionScript 3.0. Я сделал этот код, который отлично работает, но когда я помещаю количество более 150 граммов, я получаю сообщение об ошибке на выходе, которое говорит об ошибке № 1006: значение не является функцией, пожалуйста, помогите. Не могли бы вы дать мне правильный код? Спасибо
//import controls
import fl.controls.RadioButtonGroup;
import flash.events.MouseEvent;
import fl.controls.RadioButton;
// This line makes the button, btnCalculate wait for a mouse click
// When the button is clicked, the determineCost function is called
btnCalculate.addEventListener(MouseEvent.CLICK, determineCost);
// These lines make the textinput and the radioButtons wait for a mouse click
// When these components are clicked, the clearLabels function is called
txtinMass.addEventListener(MouseEvent.CLICK, clearLabels);
// This is the determineCost function
// e:MouseEvent is the click event experienced by the button
// void indicates that the function does not return a value
function determineCost(e:MouseEvent):void
{
// declare the variables
var Mass:uint;
var Letter:RadioButtonGroup = new RadioButtonGroup("Letters");
// put the groups together
FirstRadio.group = Letter;
SecondRadio.group = Letter;
// get the mass from the user
Mass = uint(txtinMass.text);
// determine the cost
if (Mass <= 30 && Letter.selection.label == "First Class")
{
lblCost.text = "0.38";
}
else if (Mass <= 30 && Letter.selection.label == "Second Class")
{
lblCost.text = "0.28";
}
else if (Mass > 30 && Mass <= 50 && Letter.selection.label == "First Class")
{
lblCost.text = "0.55";
}
else if (Mass > 30 && Mass <= 50 && Letter.selection.label == "Second Class")
{
lblCost.text = "0.40";
}
else if (Mass > 50 && Mass <= 100 && Letter.selection.label == "First Class")
{
lblCost.text = "0.73";
}
else if (Mass > 50 && Mass <= 100 && Letter.selection.label == "Second Class")
{
lblCost.text = "0.55";
}
else if (Mass >= 150 && Letter.selection.label == "First Class")
{
lblCost = ((0.73 + 0.24 * Math.floor((Mass - 100) / 50)))();
}
else if (Mass >= 150 && Letter.selection.label == "Second Class")
{
lblCost = ((0.55 + 0.19 * Math.floor((Mass - 100) / 50)))();
}
}
// This is the clearLabels function
// e:MouseEvent is the click event experienced by the textInput and the radioButtons
// void indicates that the function does not return a value
function clearLabels(e:MouseEvent):void
{
lblCost.text = "";
txtinMass.text = "";
}
Я почти уверен, что ошибка в моих последних двух операторах else if. Я пытаюсь сделать так, чтобы ответы уравнений появлялись, когда я помещаю массу более 150 граммов.