var age:Number;

var stone:Number;

var pound:Number;

var feet:Number;

var inch:Number;

var tweight:Number;

var theight:Number;

var heightS:Number;

var BMI:Number;

var movie:MovieClip;

stone_txt.text = "0";

pounds_txt.text = "0";

inch_txt.text = "0";

feet_txt.text = "0";

age_txt.text = "0" ;

sex_txt.text = "M/F";

this.createEmptyMovieClip("container",this.getNextHighestDepth());

bmibutt_btn.onPress = function()

{

age = parseInt (age_txt.text);

stone = parseInt(stone_txt.text);

pound = parseInt(pounds_txt.text);

feet = parseInt(feet_txt.text);

inch = parseInt(inch_txt.text);

//convert the age value into BMI.

//convert the stone value into pounds. 14 pounds per stone.

tweight = stone*14;

//work out the total weight in pounds.

tweight = tweight + pound;

//convert feet into inch. 12 inch per foot.

theight = feet*12;

//work out the total height in inch.

theight = theight + inch;

//woking out the squared of height.

heightS = theight * theight;

//woking out the BMI value.

BMI = (tweight * 703) / heightS;

BMI = Math.round(BMI);

//display bmi value in txt box.

trace(BMI);

bmiscreen_txt.text = BMI;

//if BMI less than 20 than the person is under weight

if(BMI <>

{

//underweight_mc._visible = true;

//normal_mc._visible = false;

//overweight_mc._visible = false;

//obese_mc._visible = false;

}

## No comments:

Post a Comment