PDA

Click to See Complete Forum and Search --> : X x Y%=?



frobby
10-14-2002, 06:00 AM
Hi, very newbie here.
I need to build a calculation.
Where X times Y% equals total. ( X xY%=? )
I need a separate box for each number.
Does anyone have any ideas for this or could point
me to a tutorial about it?
It's just a little ditty for my home web site.
I'm using MX.
Thanks in advance
frobby:confused:

mike_flashmx
10-18-2002, 09:41 PM
Deleted.

exorcyze
10-20-2002, 07:43 PM
You mean as in percent, so you want them to type in a value of 60 and a percent of 10 and have it spit out 6?

Just divide the number by 100: 10 / 100 = .1
Then multiply that by the number: 60 * .1 = 6

All in all:
txtTotal.text = parseInt(txtAmount.text) * (parseInt(txtPercent.text) / 100);

Hope that helps...

mike_flashmx
10-20-2002, 10:38 PM
Deleted.

xDrunkCowx
10-24-2002, 02:10 AM
Okay,
Put this on a blank mc in your main time line:

onClipEvent (enterFrame) {
_root.a = _root.num1 * _root.num2 /100;
}

Then make a input text box called _root.num1
Then make a input text box called _root.num2
Then make a Dynamic text box called _root.a

Now test the movie (contral-enter) and what ever you put in the first text box is your starting var. Then what ever you put in your 2nd text box is the % of the first text box (and then the answer shows up in the 3rd text box)

Hope i helped