PDA

View Full Version : math problem


philspeakman
02-27-2003, 01:07 PM
i used this
var height3 = eval(height2)+eval(inches);
height 2 was a number divided by 12 - that bit worked
as does the input for inches so i assume its an eval problem should i be using some thing else?
Ta
Phil

lbower
02-27-2003, 01:17 PM
I'm not too familiar with the eval() function, but I just looked it up in a Flash MX book and it looks like it only applies to string expressions. Just out of curiousity, what happens if you remove eval from your code?

philspeakman
02-27-2003, 01:50 PM
it concatinates the numbers, which ain't no good to no one

avatar
02-27-2003, 02:56 PM
Hi philspeakman,

Could you put a bigger piece of the code here... including all the vars?

annexion
02-27-2003, 05:19 PM
Check the scope of your variables, and put Number() around the eval statements. In Flash 5, at least, I had problems with adding variables. And it only screws up when adding. So, use the number "command" and that should fix the problem.

Good luck.