I'm not very familiar with flash so this is my current problem to deal with. I've found some code but it's in actionscript 2.0, when i tried to run it in my project, it shows the following error.
Here are my errors: 1. Scene 1, Layer 'Layer 2', Frame 1, Line 6
1067: Implicit coercion of a value of type Number to an unrelated type flash.text:TextField.
- Scene 1, Layer 'Layer 2', Frame 1, Line 8
1180: Call to a possibly undefined method on.
- Scene 1, Layer 'Layer 2', Frame 1, Line 8
1120: Access of undefined property release.
var weight_BMI;
var height_BMI;
var BMI_FINAL;
total_BMI=Number(weight_BMI.text)/(Number(height_BMI.text)*Number(height_BMI.text));
on(release){
trace(weight_BMI.text)
trace(height_BMI.text)
trace(BMI_FINAL)
}
AS2is very different fromAS3.AS3works by using methods (in the same way asJava, for example). See the code below as an example (note, you may need to edit/rename your fields to get it to compile)It works by attaching a
Click EventListenerto your calculate button which when triggered it runs thecalculateBMImethod. This method then performs the calculation and prints the result to your text field.