This content has been marked as final. Show 15 replies
the text property of textfields is a string. you need to convert that string into a number. use the Number() function.
Thanks Keith, you have always been an incredible advisor on stuff like this..
I did set the variables at it looked like this..
Input box instances were named Value1 and Value2, the variables were v1 and v2. Dynamic instance was named Result1 and variable was r1...
var Value1:Number = v1
I know I need to get back in the groove, but I am really missing something basic.
using variable typing won't convert a string to a number. use:
I get a NaN error in the DYNAMIC text box...
if v1 and v2 are instance names, use v1.text and v2.text instead of v1 and v2 inside the Number() function. if v1 and v2 are variable names make sure neither of your textfields have html enabled and they do not have auto kern checked.
I am not sure what AutoKern does, but unchecking the box made it work. Thanks for the help. I never would have thought of that.
auto kern enables html in your textfield. so, the variable value of a textfield that contains the number 5 actually looks something like:
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="16" COLOR="#00FF66" LETTERSPACING="0" KERNING="0">5</FONT></P></TEXTFORMAT>
Well, this is why your are the village flash_king and I am but a village sewer maintenance man. lol.
So, the very last line needs to add up all of the math in the first ten variables... following your example from before and applying that to the last line, I get the dreaded NaN...
Wouldnt the formula work for simple addition of variables?
is your last term a typo error?
Not that I am aware of... :)
I basically need the values of the variables: trdtotval* (in the first group) to be added together for the sum of all the variables to be displayed.
basically, you have shown me that the variable trdtotval1 will eaqual trditem1 multiplied by trdval1 in this code:
trdtotval1 = Number(trditem1)*Number(trdval1);
To give you an idea of the application, say "trditem1" (which stands for 'Trade Item') is 50 concert tickets, and "trdval1" (which stands for 'Trade Value') is equal to $10.00 (although i have yet to learn how to convert to a currency format, we just call it 10) - Then the "trdtotval1" (which stands for 'trade total value') will equal 500 ($500.00)
Now, I have inputs for ten trade items and I need to get the total value for each line/item. At the end of the application, I need to complete total of ALL TEN line items.
So... it would look something like this:
1. 5 10 General Admission Tickets 50
2. 5 5 Parking Passes 25
(ten items like the above)
TOTAL: ------------------------------------------- 75
I need the total (75)
Does that make sense?
then where's trd1val0 defined?
See Keith... this is what happens when you give a 3 year old with mild learning disorders a PC with a fancy flash program.
Your lil' idiot buddy.
lol. you're welcome.