Need help ASAp

I creat a lot of Flash calucalto at my work and keep running in to the same issue each time I start a new…

I seem to have problem properly declaring what needs to be treated a “Number” and “Text”

Because of this I keep getting the dreadful “NaN” when I calculate my number.

I attached the FLA and I CAN’T FIGURE OUT WHAT I’M DOING WRONG…

I attacherd ther FLA to this thread. Someone please review my script in this FLA and hopefully tell me I’m just making a minor error,

I have to present functionality proof tomorrow to my client so I really need to figure this out ASAP.

um…wheres the .fla?

here you go - soory about that

gezz - i had no idea i did that - really sooy

were you able to download the FLA?

i thought it went through but let me try again

thanks so much for helping me with this - it;s been driving me cracy!!!

just noticed my zip exceeds the size requirements - is it possbile to just email the FLA to you directly?

i’m really desperate right now

I noticed several views on this thread but haven’t been fortunate to have someone response with help.

Can anyone help me?

The FLA should be loaded into this thread - if it’s not please let me know and I’ll try it again.

Thank you

Do you see an fla attached, because I don’t.

Looks like my files size is too large to upload. Is there a way I can email the FLA directly so that you can take a look at what I’m doing wrong with this.

If not, here’s some of the script that I created…

// COMMA FUNCTION
Number.prototype.commaFormat = function() {
n = this.toString();
insPTR = 1;
if (n.indexOf(".") == -1) {
t = “”;
n = n.split("");
} else {
t = n.substr(n.indexOf("."), n.length);
n = n.substr(0, n.indexOf(".")).split("");
}
for (ptr in n) {
t = n[ptr]+t;
if (insPTR++ == 3) {
insPTR = 1;
t = (isNaN(n[0]) && ptr>1) || (!isNaN(n[0]) && ptr>=1) ? “,”+t : t;
}
}
return t;
};
// INPUT VARIABLES
var varInput_housing:Number = 0;
varInput_housing = Input_housing;
var varInput_food:Number = 0;
varInput_food = Input_food;
var varInput_transportation:Number = 0;
varInput_transportation = Input_transportation;
var varInput_healthcare:Number = 0;
varInput_healthcare = Input_healthcare;
var varInput_personalNeeds:Number = 0;
varInput_personalNeeds = Input_personalNeeds;
var varInput_taxes:Number = 0;
varInput_taxes = Input_taxes;
var varInput_entertainment:Number = 0;
varInput_entertainment = Input_entertainment;
var varInput_travel:Number = 0;
varInput_travel = Input_travel;
var varInput_familyFriends:Number = 0;
varInput_familyFriends = Input_familyFriends;
var varInput_education:Number = 0;
varInput_education = Input_education;
var varInput_charity:Number = 0;
varInput_charity = Input_charity;
var varInput_otherOne:Number = 0;
varInput_otherOne = Input_otherOne;
var varInput_socialSecurity:Number = 0;
varInput_socialSecurity = Input_socialSecurity;
var varInput_pension:Number = 0;
varInput_pension = Input_pension;
var varInput_annuities:Number = 0;
varInput_annuities = Input_annuities;
var varInput_mutualFunds:Number = 0;
varInput_mutualFunds = Input_mutualFunds;
var varInput_stocks:Number = 0;
varInput_stocks = Input_stocks;
var varInput_bonds:Number = 0;
varInput_bonds = Input_bonds;
var varInput_cds:Number = 0;
varInput_cds = Input_cds;
var varInput_managedMoney:Number = 0;
varInput_managedMoney = Input_managedMoney;
var varInput_realEstate:Number = 0;
varInput_realEstate = Input_realEstate;
var varInput_otherTwo:Number = 0;
varInput_otherTwo = Input_otherTwo;
var varInput_IRA:Number = 0;
varInput_IRA = Input_IRA;
var varInput_401K:Number = 0;
varInput_401K = Input_401K;
var varInput_403b:Number = 0;
varInput_403b = Input_403b;
var varInput_SEP:Number = 0;
varInput_SEP = Input_SEP;
var varInput_otherThree:Number = 0;
varInput_otherThree = Input_otherThree;
// CALCULATION VARIABLES
var Calculation_totalEssentialExpenses:Number;
Calculation_totalEssentialExpenses = Math.round(Number(Input_housing) + Number(Input_food) + Number(Input_transportation) + Number(Input_healthcare) + Number(Input_personalNeeds) + Number(Input_taxes));
var Calculation_totalDiscretionaryExpenses:Number = 0;
Calculation_totalDiscretionaryExpenses = Math.round(Number(Input_entertainment)+ Number(Input_travel)+ Number(Input_familyFriends)+ Number(Input_education)+ Number(Input_charity)+ Number(Input_otherOne));
var Calculation_totalMonthlyExpenses:Number = 0;
Calculation_totalMonthlyExpenses = Math.round(Number(Calculation_totalEssentialExpenses)+ Number(Calculation_totalDiscretionaryExpenses));
var Calculation_totalAnticipatedGuaranteedIncome:Number = 0;
Calculation_totalAnticipatedGuaranteedIncome = Math.round(Number(Input_socialSecurity)+ Number(Input_pension) + Number(Input_annuities));
// DISPLAY FIELDS
this = Calculation_totalEssentialExpenses;
Display_totalEssentialExpenses.text = “$” + this.commaFormat();
this = Calculation_totalDiscretionaryExpenses;
Number(Display_totalDiscretionaryExpenses.text = “$” + this.commaFormat());
this = Calculation_totalMonthlyExpenses;
Number(Display_totalMonthlyExpenses.text = “$” + this.commaFormat());
this = Calculation_totalAnticipatedGuaranteedIncome;
Number(Display_totalAnticipatedGuaranteedIncome.text = “$” + this.commaFormat());
// BUTTON FUNCTIONS
btnClickHereToSubmit_mc.onRelease = function(){
gotoAndStop(“frameCalculationOne”);
};
stop();

Host your file here.

Thanks so much for that suggestion. Here’s the link to download…

This thing need a lot of work. You’re not even using any validation for what the user types in.

In any case - on frame one you are setting Display_totalEssentialExpenses.text = “$” + this.commaFormat();

There’s no number to return at this point, the user hasn’t entered anything in. Not sure why on frame one you are setting that text field to a number value.

Either

A) Just do this


Display_totalEssentialExpenses.text = "$";

or

B) just comment that line out on frame 1 it doesn’t need to be there

Thanks.

I haven’t gotten to the input validation stage just yet. I’ve done that logic on other calculators that asked for user input versus other ones that I was able to control their entries (ie… slider bars with value increments or radio buttons).

Can you offer any suggestion on best practices for scripting the validation?

I usually create an array for my error messages. On submit I push all error messages inside the array, check to see if there is a value if so have an mc pop up with an error count and all error messages etc…

Cool - do you mind if I send my FLA tomorrow or the next day when I have my conditions in there?

I’m still learning AS and you’d be a fantastic resource to evaluate if I’m going in the right direction.

Yea I don’t mind as long as I have the time. I can at least get you going in the right direction.