A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: Text Fields - displaying currency

  1. #21
    Junior Member
    Join Date
    Jan 2001
    Posts
    13

    it was the root movie thing

    Ok, as soon as I got rid of all the "/:" everything worked fine! Thanks again for that, I'll put the file up somewhere when its finished!

  2. #22
    Member
    Join Date
    Mar 2001
    Location
    Venice, CA
    Posts
    88

    tutorial ahoy!

    Not to belabor the thread, just wanted to let you know that I submitted a tutorial going over all of this (with the fixes). My first tutorial. I hope it's okay!

    Anyway it's been a fun first few days here at Flashkit - thanks! See you around!

  3. #23
    Junior Member
    Join Date
    Jan 2001
    Posts
    13

    just when you thought it was safe....

    I'm guessing it takes a while before your tutorial appears here. I was looking for it before I was going to post this, didn't want to bug you again!

    Ok, now I've gotten everything to work. I realised that I couldn't use the same code for every product, so I slightly modified the code so that the variables are unique to each item. No biggy.

    But then when I got to my final page, I realised I hadn't put in a total price (adding up all the prices together). I had a total price for each item, but not a total price of all items added together.

    Method 1:

    I tried to ust add up the variables together to get a total. My total kept being "0", not even the dollar sign came up. I realised that I what I was trying to do was add string. back to drawing board.

    Method 2:

    Seeing as I couldn't add strings, I thought I'd break apart the strings into their last numerical form and add those up. The only problem is that with the decimal place, it makes this very hard.

    What I've done so far is add all the "befroePrice" variables on all products, then add all the "afterPrice" variables. Then copied the code for a product and incorporate it into this "totals" code. Again, changing nessesary variables to make its code unique.

    You may be able to see what problems I'm having now. For some reason it will except the first product's code and get me a total for it all the time.

    ie: if I have 3 products (productA, productB, productC) and I only want to order the first product, I place an order for 1 productA. I submit this and it somes out that my total price for the amount of productA's (in this case only 1) is the same as the total for all products together. I've tested this with multiple amounts of productA and it works perfectly.

    If I then try to add any amount of either other 2 products (B and C) for some reason my total is totally way out. Even if I only add 1 of say productB it still is out.

    I would like to show you the code, but I think this post is too long already.

    The only thing I can think of is that either I have coded my total sum incorrectly or for some reason flash doesn't like decimal places.

    I think I've explained everything. If you, or anyone else can help me, my head may just keep from exploding!

  4. #24
    Junior Member
    Join Date
    Jan 2001
    Posts
    13

    I got it now....

    Ok, don't worry. I found the problem. There was actually 2 problems.

    The first was my method of adding up the total prices... you'll laugh at this. Instead of taking the cleanest variable (the very first one actually, the one that gets the price of the item ordered) I took the last one possible!!! Not very bright I know... Anyway, because I was using a completely hacked up variable, I was adding up numbers before the decimal and after the decimal, then trying to place a decimal in between them... as you can tell this was not ideal.

    To solve this I did the obvious, I used the first variable and added them up instead. This was very clean as all I did was a simple x = a + b + c deal. none of this beforePriceA + beforePriceB crap (no offense to your code, its actually very solid, just that for a simple total price it was unessessary of me to think that I needed to go through all that again). Anyway after I did this, I was sure that it would work fine...

    So when it didn't, I thought I'd give the code another analysis and see if there WAS something out of whack. Sure enough, it was in the 3rd line!!!!!!!!! It was pretty well hidden though, I can see how I made the mistake.

    Anyway, I now have more respect for programmers than I ever had and everything works perfectly. The only thing I can't understand is that why did this missed coding only affect the 2nd and 3rd products and not the 1st. From where is was, i don't see how it could.

    Anyway, thanks again for all your help. I'll be sure to check out your tute as soon as it is online!

  5. #25
    Member
    Join Date
    Mar 2001
    Location
    Venice, CA
    Posts
    88

    congratulations, plus a shameless plug

    Sounds like you've been through quite an ordeal to get this working! I'm glad it all worked out in the end - congratulations!

    In case anyone cares, the tutorial is up:
    http://www.flashkit.com/tutorials/Ac...05/index.shtml

    However I made an error in the code (didn't account for rounding up a dollar), and there's an error in the tutorial presentation as well (the full code didn't get posted), so corrections are posted here:

    http://board.flashkit.com/board/revi...hreadid=124640


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