dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: dynamic price with cents in superscript

  1. #1
    Senior Member unicycle's Avatar
    Join Date
    Mar 2000
    Posts
    254

    dynamic price with cents in superscript

    I'm building a store.
    Each item will be displayed with a sticky price, like in the pre-barcode ages.

    I wonder if there is a way to have

    price = "$11.11";
    or
    price = "$8888.88";
    (mind the difference in width)

    being displayed in a dynamic textbox, centered, with the cents in superscript. Or if there is any other way to get it displayed that way.

    Another way could maybe be an actionscript creating a new static textbox....?

    Any examples?

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    just an idea: create a font with digits and superscript digits

    Musicman

  3. #3
    Senior Member unicycle's Avatar
    Join Date
    Mar 2000
    Posts
    254
    That's a perfect workaround! Thanks.
    I certainly will do that.

    Another (but more bytes and cpu wasting) solution would be:

    Devide the price in two dynamic text boxes,
    have the decimals in a mc,
    and have:
    Code:
    _root.pricedecmc._x += PriceTag("$12.34");
    
    // and
    
    function PriceTag(price) {
      nxt = 0;
      x   = 0;
      while (nxt < price.length) {
        c = price.substr(nxt, 1);
        if (c == ".") { break }
        if (c == "$") { x += 5.1; }
        if (c == "E") { x += 5.2; }
        if (c == "0") { x += 5.3; }
        if (c == "1") { x += 5.4; }
        if (c == "2") { x += 5.5; }
        if (c == "3") { x += 5.6; }
        if (c == "4") { x += 5.8; }
        if (c == "5") { x += 5.9; }
        if (c == "6") { x += 5.5; }
        if (c == "7") { x += 5.6; }
        if (c == "8") { x += 5.2; }
        if (c == "9") { x += 5.2; }
        nxt++;
        }
      return x;
      }
    Last edited by unicycle; 10-23-2005 at 03:17 AM.

  4. #4
    Junior Member
    Join Date
    Apr 2008
    Posts
    8
    I got my Subscript and Superscript fonts from:
    http://www.subscriptfont.com
    They work perfect with dynamic fields too...

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