5 Replies Latest reply on Mar 25, 2008 4:29 AM by rlc5611

# Simple Calculation Problem

minutes = hours_txt.text*60+minutes_txt.text;

If I enter the text in hours_txt is 5 and minutes_txt is 10, why is that the result of the calculation is 30010 not 310?
• ###### 1. Simple Calculation Problem
Flash is concatenating it as a string, because one of the operands is a string and + is a valid string operator.

If you want a number try this:

minutes = hours_txt.text*60+Number(minutes_txt.text);

or

minutes = Number(hours_txt.text)*60+Number(minutes_txt.text);

• ###### 2. Re: Simple Calculation Problem
Thanks
• ###### 3. Re: Simple Calculation Problem
No problem, you're welcome
• ###### 4. Re: Simple Calculation Problem
Hi there,

I am also having a relatively simple calculation program. I have a calculation, which is shown to the user, and may times ends up being a fraction. I have been hunting down ways of rounding this result up, so further calculations can be performed. (Its for a wood production company who need to calculate produce in fixed amounts).

does anyone have a code which would make my result round up to the nearest whole number?