I need some help here...I'm trying to get the value of user input from the TextInput Component which is the age, height and weight to calculate the bmr and display the result in member("result").text.
How am i suppose to let the integer pass through in order for me to perform calculation? Would appreciate if anyone can help me out with this, thanks!
Below are the formula :
The Harris Benedict equation estimates BMR:
For women: (9.56 x w) + (1.85 x h) – (4.68 x a) + 655
For men: (13.75 x w) + (5 x h) – (6.76 x a) + 66
Put this in your "Done" button's behavior: (assuming you have a global variable for male vs female, called globalGender--change to what ever you have)
global globalGender
if globalGender = "Female" then
member("result").text = (9.56 x value(member("weight").text)) + (1.85 x value(member("height").text)) – (4.68 x value(member("age").text)) + 655
else
member("result").text = (13.75 x value(member("weight").text)) + (5 x value(member("height").text)) – (6.76 x value(member("age").text)) + 66
end if
Assumed that this section is only for male ...it still show error saying script error : String expected for
on mouseDown
member("result").text = (13.75 * value(member("weightText").text)) + (5 * value(member("heightText").text)) - (6.76 * value(member("ageText").text)) + 66
end
Do i have to add in "put sprite(x).text -- where x is the number of the sprite that is the text input." ?
My mistake. You can only asign a string to the text property of a text member. Just need to convert the value returned to a string using the string function. Use this
member("result").text = string((13.75 * value(member("weightText").text)) + (5 * value(member("heightText").text)) - (6.76 * value(member("ageText").text)) + 66)
North America
Europe, Middle East and Africa
Asia Pacific