I am trying to make a simple calculator I have been following this guide:
this is my code.
var calc:Number = 25;
num1.restrict = "0-9";
num2.restrict = "0-9";
Hnum = num1.txt;
PCnum = num2.txt;
Total = parseInt(Hnum) * calc;
Total_txt.text = String(Total);
I am getting these 3 errors:
|Scene 1, Layer 'Actions', Frame 1, Line 14||1067: Implicit coercion of a value of type flash.text:TextField to an unrelated type String.|
|Scene 1, Layer 'Actions', Frame 1, Line 15||1067: Implicit coercion of a value of type flash.text:TextField to an unrelated type String.|
|Scene 1, Layer 'Actions', Frame 1, Line 16||1067: Implicit coercion of a value of type Number to an unrelated type String.|
I have two input text boxs named num1 and num2 and then one dynamic text box named Total_txt.
This should be so simple I really don't know what im doing wrong?
Any help would be really appreciated.
If you look at the tutorial I think you will see that you are using "txt" where "text" is required. "text" is a property of a textfield, identifying the text that the textfield holds. I don't know if you are doing something where the num1 object contains another object named txt, but I think my first sentence catches the problem.
Europe, Middle East and Africa