# Need help ASAp

**URL:** <https://forum.kirupa.com/t/need-help-asap/263381>\
**Category:** flash\
**Created:** [June 15, 2008, 1:00pm UTC](https://forum.kirupa.com/t/need-help-asap/263381 "2008-06-15T13:00:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 15, 2008, 1:00pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/1 "2008-06-15T13:00:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 15, 2008, 1:43pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/2 "2008-06-15T13:43:33Z")

</div>

um…wheres the .fla?

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 15, 2008, 1:55pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/3 "2008-06-15T13:55:37Z")

</div>

here you go - soory about that

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 15, 2008, 1:57pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/4 "2008-06-15T13:57:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 15, 2008, 2:17pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/5 "2008-06-15T14:17:21Z")

</div>

were you able to download the FLA?

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 15, 2008, 2:37pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/6 "2008-06-15T14:37:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 16, 2008, 3:27am UTC](https://forum.kirupa.com/t/need-help-asap/263381/7 "2008-06-16T03:27:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 16, 2008, 4:03am UTC](https://forum.kirupa.com/t/need-help-asap/263381/8 "2008-06-16T04:03:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 16, 2008, 4:15pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/9 "2008-06-16T16:15:14Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 16, 2008, 4:19pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/10 "2008-06-16T16:19:06Z")

</div>

Host your file here.

> **[Share files and collaborate on creative projects](https://www.hightail.com/)**
>
> Hightail is the best way to collaborate on creative projects. Easily send and share large files securely and get feedback in one place. Sign up for free.

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 16, 2008, 4:33pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/11 "2008-06-16T16:33:47Z")

</div>

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

> **[Hightail Spaces](https://spaces.hightail.com/resolve/ufid/0A5799CA5D76679F)**
>
> Hightail Spaces lets you send unlimited files, of any size, to anyone. Collaborate with your team and evolve your work.

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 16, 2008, 7:08pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/12 "2008-06-16T19:08:50Z")

</div>

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

```auto

Display_totalEssentialExpenses.text = "$";

```

or

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

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 16, 2008, 7:34pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/13 "2008-06-16T19:34:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 16, 2008, 7:38pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/14 "2008-06-16T19:38:16Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![DdigitalD](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DdigitalD](https://forum.kirupa.com/u/DdigitalD)\
**Post date:** [June 16, 2008, 7:47pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/15 "2008-06-16T19:47:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 16, 2008, 8:21pm UTC](https://forum.kirupa.com/t/need-help-asap/263381/16 "2008-06-16T20:21:41Z")

</div>

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