PDA

View Full Version : Help with Savings Calculator


HechtDA
04-09-2009, 07:10 PM
Hello Everyone,

I'm new to the forum and fairly new to the flash world. I'm creating a website where I need to create a savings calculator. There will be one input value and then 4 output values that are needed.

Here is what I'm looking for:

Enter Monthly Expense: (this would be the input field)

Output fields as follows:

output 1: this needs to multiply the input value by 240 then multiply by .1
output 2: this needs to multiply the input value by 240 then multiply by .2
output 3: this needs to multiply the input value by 12 then multiply by .1
output 4: this needs to multiply the input value by 12 then multiply by .2

I have the basic layout created in flash, but just need to know what to put in the actions in order to get it to work.

Let me know if any additional information is needed.

Thanks so much in advance!!!!

neilmmm
04-09-2009, 11:22 PM
var num:Number=input_txt.text;
output1_txt.text=((num*240)*0.1)

something like this ... i think you should get the idea

kkbbcute
04-10-2009, 06:03 AM
All that code that Neilmmm should be put inside a button or an MC that you would use as a button. ( I recommend the latter)

HechtDA
04-10-2009, 06:35 PM
Ok, so I'm obviously doing something wrong... I can't get it to work.

Can someone take a look at my file and help me out?

Ideally, I'd like the flash to act exactly like it does in the excel file that is in the .zip.... I've tried doing it that way, as well as using the submit button to start the action, but no luck! :confused:

(The flash file is also in the .zip)

Any help you guys could provide would be greatly appreciated!!!!

kkbbcute
04-11-2009, 05:41 AM
The problem here is that you have included one extra ")" bracket in your code on the line saying Output.text = ... on the on(press) function.

Apart from that, the biggest problem is that you don't have a text box top put your text in! You can't just define the text of a textbox which doesn't exist. Right now, you are using the graphic syymbol in the place of a textbox, you can't do that ;)

cjx3711
04-11-2009, 04:32 PM
Here's your file:

By the way, there is a function on the main timeline. It's useless.

The first frame looks like this :

var num:Number;// THis is important


//You can delete anything below this line. I was just experimenting.
function Calc() {
num = Input1_txt.text;
Output1.text = (num*240*0.1);
Output2.text = (num*240*0.2);
Output3.text = (num*12*0.1);
Output4.text = (num*12*0.2);
}

kkbbcute
04-12-2009, 04:49 AM
Also, another best practice recommendation, name your text boxes and vars so you can remember them, you will value this once your files grow many times more complicated ;) :
var varOutput:Number;

function funcCalculate() {
varOutput = textInput1.text;
textOutput1.text = (num*240*0.1);
textOutput2.text = (num*240*0.2);
textOutput3.text = (num*12*0.1);
textOutput4.text = (num*12*0.2);
}

Just a tip I thought I'd share.

HechtDA
04-12-2009, 05:16 AM
Ok, CJX3711, I'm really anxious to see what the file is you attached, but for some reason I get a Flash 8 Unexpected file format when I try to open the .fla file inside the .zip. Any ideas?

I haven't had time to really work on this today, but I will be working on it on Sunday, so hopefully I can get it working then!

Also, thanks everyone for the input!!!

kkbbcute
04-12-2009, 05:22 AM
Try this:

HechtDA
04-12-2009, 05:34 AM
UGH, still not working. No clue why.

Edit: Nevermind - got your PM kkbbcute....thanks

Anyone with CS3 that can save the file in Flash 8 for me? Thanks.

kkbbcute
04-12-2009, 05:35 AM
Got it converted for Flash 8, here you go:

HechtDA
04-12-2009, 05:45 AM
AWESOME!!!!! Thanks so much everyone!!!!! I appreciate all the help, it's working how I wanted it!!!! You guys have helped me to learn A LOT with this!

kkbbcute
04-12-2009, 05:56 AM
No problem, glad we all could help.

Good luck with new found calculator ;)