dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: The case of the missing decimal

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    6

    The case of the missing decimal

    I created an application that adds two numbers and adds the result to a Technical Drawing that a customer can customize and print. The problem is when the number adds up to any number with .00 or .10 the program will drop the decimal with a dangling 0 example:

    var partNumStroke = number(stroke_in);
    var stroke_f = number(stroke_in) + number(5.75);

    If the varible "stroke_in=1.25+ 5.75 it should equal
    7.00 but instead it equals 7 dropping the .00 but if the sum equals 7.13 it keeps the 2 decimal places,

    Is there a better way to keep decimals and keep the .00s always. This client of mine specifically needs to have all the decimal places because of the technical nature of the drawings.
    Thanks ahead o' time for the help

    ps

  2. #2
    dmacker = new Person()
    Join Date
    Jan 2005
    Location
    Woburn, MA
    Posts
    143
    I came across a solution to your problem on actionscript.org. The URL for the thread is:

    http://www.actionscript.org/forums/s...=decimal+point

    I extracted the script that does the conversion and put it in a new file. HOWEVER, all the credit for this code must go to "emergency_pants" over on actionscript.org. I take zero credit.

    See the attached file.
    Attached Files Attached Files
    I am an instance of the Person class.

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397

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