Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to add up numbers in director

Status
Not open for further replies.

directorguy

Programmer
Nov 10, 2000
16
0
0
US
hi folks,
I am creating a page in my program where I need to add a column of numbers entered by the user. It's going to be real simple like "how much do you want to contribute to this $_____" Is there an easy way or any way to do this?

Thanks for your help.
 
Hi,

It is pretty simple, try this:-

on mouseUp me

member("total").text = string(member"amount1").text.value + member("amount2").text.value + member("amount3").text.value + member("amount4").text.value + member("amount5").text.value + member("amount6").text.value + member("amount7").text.value)

set the floatPrecision = 2
put string(100.0 / 10.0) into temp
set the itemdelimiter = "."
put the number of chars of item 2 of temp into total
repeat while total < the floatPrecision
put "0" after item 2 of temp
put the number of chars of item 2 of temp into total
end repeat
end

'total' is the text field which will display the total on the stage. 'temp' is a text field which does not appear on the stage but is used to store the string.
Give it a try, it should solve your problem, as it were.

Regards
AJJA17
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top