Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default Variable issues... please help

    Hi, over the past couple weeks i have been making a flash program. The way this program works is frame by frame the user enters values into text inputs, then clicks next to go to the next frame, and so on until the end where some calculations are made with the values previously entered. The values are stored in variables on the event of onRelease of the Continue button for each frame.
    First I should tell you that i am using Action script 2.0. What i want to do, that isn't working so far, is to have it so they can go back to the previous frame and the previously entered value will still be in the text input. So far i cannot figure it out.
    An Example of the code used for storing the variables is

    on (release) {
    numReg = numReg.text;
    numCC = numCC.text;
    numCheque = numCheque.text;
    perDec = perDec.text;
    perBounce = perBounce.text;
    perInc = perInc.text;
    gotoAndStop(nextFrame());
    }

    The numReg.text, numCC.text etc. are all the values of the text inputs(numReg, numCC and so are are just the instance names)

    An example of the code that i tried to use to accomplish my goal is:

    on (release) {
    gotoAndStop(prevFrame());
    numReg.text = numReg;
    numCC.text = numCC;
    numCheque.text = numCheque;
    perDec.text = perDec;
    perBounce.text = perBounce;
    perInc.text = perInc;
    }

    I tried putting this code into the Back button of the next frame and after clicking the back button the values would not show up in the text inputs. They would just stay as the default value set in the Paramaters of each text input.

    If anybody can help me figure out how to solve my issue it would be very much appreciated.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    If you insert an actions layer the length of the timeline, you can instantiate and preserve your variables throughout the timeline. On the first keyframe of your actions layer, define your variables to be used. If not assigned a value until a user inputs data, simply define them as null or undefined...
    Code:
    numReg = null;
    numCC = null;
    numCheque = null;
    perDec = null;
    perBounce = null;
    perInc = null;
    Once the variables are defined, you can assign and change values and the data will be preserved over the entire timeline. So, if you assign the variable values to each keyframe, they will be preserved when the playhead stops on a particular keyframe.

    hope it helps
    NTD
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial