well duh… I know that. I figured that they weren’t returning the right thing so since they seem like they are supposed to be returning 0 then they aren’t… you get it?
I did pass Calculus… i can add and multiply :):):P:trout:
Oh… haha Jubba, I wasn’t replying to your reply… although now I see it does look like that…ooooops.
I was responding to Didius on why it wasn’t working, because all it will return is 0, so how will it work?
Since his example file didn’t work (supposing he is on a Mac since there are issues with attaching .fla files when you use a mac…zipping them fixes that) I couldn’t check out what he was doing, so I assumed this was the issue.
My mother is always saying i’m doing nothing all day (she right, but I don’t like to admit) So I decided to make something wich helps her administration. She should just enter the money she paid and the money she got, and then she would be able to see the balance. But it’s not working.
Well it is a very simple solution, but the problem itself has me confused to no end. For some reason your script is parsing “e” as text so you are telling “f” to display the text inside “e” and 21 at the end of that.
Why it is only doing it for that textbox I have no clue since you have a whole bunch of other textboxes that work fine.
The solution is to use parseInt() which parses a string into an integer (given that string is an actual integer and not text)
[AS]a = 0;
b = 0;
e = 0;
_root.onEnterFrame = function() {
c = a*b;
d = c+((c/100)*21);
f = parseInt(e)+21;
};[/AS]
This goes by if your textboxes have the INSTANCE names of a, b, c, d, e, and f. According to your file you have their VAR names as the letter (which is all well and good for the original way you had it, but for what I did here it needed to be the instance name).
The line above uses restrict feature in Flash to restrict the characters you can use in your input textbox. In this case, only the characters 0-9 can be used. Since there is no need for letters in this case… why allow the chance of accidently hitting one?
[AS]a.text = b.text=e.text=0;[/AS]
As for this line above, well you probably already know what it does… but you may not know why I use .text.
When going by the instance name of a textbox you MUST use .text to be able to add text into the textbox, or retrieve the value of the string in the textbox. You don’t need to add .text when you are using the VAR name (actually it won’t work if you do), but you have to use it when you are using an INSTANCE name for your textbox.