5 Replies Latest reply on Aug 17, 2007 2:15 PM by FlashTastic

    Textfields input/output

    var_dating=porking
      have 4 text fields on the stage. salary_txt, percent_txt, dollar_txt, total_txt (1 on top, 2 below that and 1 below that).

      - onload, salary is set to 50000 (and therefore total_txt displays 50000).
      - I go ahead and add 3% to (percent_txt).
      - dollar_txt should now display $1500 & total_txt should now display $51500

      Then if I decide I want to increase the total, but this time using a dollar value, I want to be able to select the value in the field ($1500) and change that to lets say...... $4000...

      - percent_txt should now display 0.08 (or 8.0 if you convert)
      - total_txt should now display $54000.

      Is that possible? If so can you point me in a direction?
        • 1. Textfields input/output
          FlashTastic Level 1
          Yep, and it's not that tough to do either.

          Create a new movie, and 3 input text fields. Name them dollar_txt, percent_txt, and result_txt.

          Create a new layer, lock it, name it actions, and place the following code on it.

          Cheers,
          FlashTastic
          • 2. Textfields input/output
            var_dating=porking Level 1
            Hmmm. that didn't appear to do anything. Would you mind taking a look at my application? I posted it here:

            http://home.comcast.net/~shane.swoboda/procalc.html

            and here is my code - i'm trying to allow a user to input an increase using a % or a dollar (middle section). If they choose percent, it should calculate the dollar field. And vise-versa, if they want to use a dollar amount, it should update the percent field.

            • 3. Re: Textfields input/output
              FlashTastic Level 1
              When re-creating my example, make sure that you're not using textField components, just use plain textFields.

              The way the example works is - you type in 50000 into box 1 (dollar_txt) and a percent into box 2 (percent_txt) and box 3 will auto-update as you are typing. If you change box 3 (from 3500, to 4000 for example), the percent box will auto update with the new percentage.


              • 4. Textfields input/output
                var_dating=porking Level 1
                Wow, noone has ever tried this? I thought for sure it would be a slam-dunk for script kiddies
                • 5. Re: Textfields input/output
                  FlashTastic Level 1
                  I think I'm having a hard time understanding you because you keep changing the names of things you're referencing.
                  Is the total_txt that you're referring to the textField beside where it says New Annual Salary / OTE? Because otherwise I have no idea what textfield you're referring to. I sent you an FLA via e-mail this morning - did you receive it?

                  You state that you want your application to perform the following:
                  1) allow input for both (percent & dollar)
                  2) recalculate the percent if you change the dollar and vise-versa, recalculate the dollar value if you change the percent.

                  What am I missing here.. ? Isn't that exactly what it's doing?

                  For example:

                  In the Current Annual Base / OTE you start with 50000.

                  In recommended salary increase , percentage is set to 5, and dollar updates itself to become 2500 (5% of 50000)
                  If I change the value in percent to 7, the value under dollar changes from 2500 to 3500. (7% of 50000)
                  If I then change 3500 to 6500, the percent field changes to 13. (6500 = 13% of 50000).