A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: significant digits

  1. #1
    Junior Member
    Join Date
    Jan 2002
    Posts
    14
    i'm trying to get a dynamic text box to display a price, ie "$ 3.50"

    the variable is added to or subtracted from, so sometimes its a whole number, in which case i need it to show the zero cents. I tried the C way of dividing by 1.00 or multiplying by 1.00, but no dice. Math.round didn't help either, so I'm always stuck with integers or only the ".5"

    is there any way to set the variable or the text box to 2 decimal precision?

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    value is the initial value, result is the formatted output.
    Code:
    d = int(value*100);
    decimal = substring(d, length(d)-1, -1);
    integer = int(value);
    result = integer+"."+decimal;
    hope this helps
    BlinkOk

  3. #3
    Junior Member
    Join Date
    Jan 2002
    Posts
    14
    i guess it came down to puttin two parts together =P

    thx very much =)

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