2 Replies Latest reply on Oct 12, 2006 7:45 PM by ricky1980

    Pass value from one frame to other frame

      Dear All,

      I put component button (enter1) and textinput ( quiz ) in layer named "form".
      And i also add a layer called "action".

      i put the following codes in the frame1 in "action" layer

      enter1.onPress=function() {

      i put the following code in the frame 14 in "action" layer


      When i enter some wording in textinput "quiz" and press "enter1" button,
      the result is that the trace window correctly show what i have typed in frame1 of "form" layer
      but when go to frame 14 in "form" layer , it will show underfined in trace window.
      What is the problem?

        • 1. Re: Pass value from one frame to other frame
          derobinson Level 1
          If the textinput "quiz" doesn't exist in the 14th frame or if you've insertedd a keyframe, thus adding a new instance of "quiz" and clearning out the text your typed in frame 1, then the variable that is "quiz.text" doesn't exist in frame 14.

          Either the text input from frame 1 has to still be on the stag in frame 14 or you need to store the text inut from frame 1 in a variable that can be accessed in frame 14. That is easy to do. In your button click code, type:

          var myVar:String = quiz.text;

          Now when you want to get the text (via trace or some other method), just use "myVar". So in frame 14, you can change the code to:


          That should do it! Good luck!
          • 2. Re: Pass value from one frame to other frame
            ricky1980 Level 1
            Hi David ,

            Your answer is correct . I discoveried that the variable "myvar" should be defined outside the button click function . Very Thanks for your help.