Urgent: Looking Flash PMT() Command

weesiong
weesiong used Ask the Experts™
on
In the visual basic and excel have a function call pmt(), it can calculator payment.

This is VB sample command:
lvTotInterest = Format(Pmt(0.0575 / 12, 300, 200000 * -1), "#########.00")

The answer will come out: 1258.21

So how about flash?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Do you mean you want to round the calculated number in flash? Or do you want to create a function that is a calculation in flash?

Commented:
just tell me what mean each parameter:

Pmt(meaning??,meaning??,meaning??)

=0)

Author

Commented:
ivanmata,

I have found the thing i want, thanks. This is the function i found.

function pmt(r,np,pv,fv) {
     r = r/1200;
     if (!fv) fv = 0;
     mypmt=-(r * (fv+Math.pow((1+r),np)*pv)/(-1+Math.pow((1+r),np)));
     finalPmt=roundOff(mypmt,2);
     trace(finalPmt);    
     return finalPmt;
}

function roundOff(value, dplaces){
value=value.toString()

if((value.indexOf(".")!=-1)&&(value.length>(value.indexOf(".")+dplaces))){
   three=value.substring(value.indexOf(".")+dplaces+1,value.indexOf(".")+dplaces+2)
   one=value.substring(0,value.indexOf(".")+dplaces)
   two=value.substring(value.indexOf(".")+dplaces,value.indexOf(".")+dplaces+1)
   if(parseInt(three)>=5){value=one+(parseInt(two)+1);value=parseFloat(value)}
   else{value=one+two;value=parseFloat(value)}
}
      return value;
}

I will delete this question.
User resolved; points refunded and question closed.

Netminder
EE Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial