A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Formatting Currency

Hybrid View

  1. #1
    will work for bananas
    Join Date
    Mar 2001
    Posts
    122
    Is there an easy wasy to convert a number to a two-digit decimal place (currency - ie - $7.42). I figured that there is probably a very simple way to do this in Version 5 using the String Object. I just need to convert a number to currency format, or add $.00 at the end if it's a whole number.

    Thanks,
    mOnkEymAn


  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    472
    There have been better methods produced since I built this .. it's not completely extensible, but it provides for 2 outputs ... output1 for a floating point number formatted with commas, and output2 for currency formatting, complete with a dollar sign, commas and rounded to cents, with pad right in place as well:

    invoked by:

    formatNum(fullNum);

    - with your input as 'fullNum' or yourVar referred to 'fullNum' (make sure it becomes a string somehow for input)
    - and output as output1 and/or output2 vars

    http://members.home.net/stringedinst...nFormatNum.swf
    http://members.home.net/stringedinst...nFormatNum.fla

    Richard

  3. #3
    will work for bananas
    Join Date
    Mar 2001
    Posts
    122
    Thanks Richard! That should work perfectly!

    Cheers,
    mOnkEymAn


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center