8 Replies Latest reply on May 9, 2011 4:35 AM by relaxatraja

    targeting variables on different timelines

    handfeed

      Flash CS4, ActionScript2.0 -  I have a button and an input text box in a movieclip.  When the button is clicked, I need the movie to jump to a frame on the main timeline and have the text that was entered into the input box in the mc, show up in a dynamic text box in the frame on the main timeline.   I finally got the movie to jump using 'with (_root) gotoAndPlay ("frame label"), but I can't get the input text value (in the mc) assigned to the dynamic text box (on the main timeline).   I've tried several versions of relative and absolute paths in the assignment statement, using variable names and instance names, tried 'with' and 'this' but no matter what I do, nothing shows up in the dynamic text box.

       

      Any help would be greatly appreciated,  Thanks.

        • 1. Re: targeting variables on different timelines
          Ned Murphy Adobe Community Professional & MVP

          You can't assign anything to the textfield directly from the movieclip if it is somewhere down a timeline.  You would need something in the frame of that dynamic textfield that assigns it the value you intend.  Which means you need to somehow make that input text string available to that frame of the timeline.

           

          So if that movieclip and the dynamic textfield don't co-exist when the main timeline reaches that frame, what you'll have to do is assign the input text to a variable that you have in a layer that extends that far (from the movieclip to the dynamic text, at least).  That way, when the main timeline reaches that frame, the code that assigns the text to the textfield in that frame can use the variable.

          • 2. Re: targeting variables on different timelines
            relaxatraja Level 5

            on  your first frame of maintime declare a variable as

             

            _root.varInput="";

             

             

            On your inner movieclip which targets main timeline

             

            For example: if you entered studentname "Rahul" in the input box and now pass the varaible to the main timeline as _root.varInput=inptxt.text;

            1 person found this helpful
            • 3. Re: targeting variables on different timelines
              Ned Murphy Adobe Community Professional & MVP

              Do you have some reason for responding to me and repeating what I just explained could be done?

               

              On the main timeline you do not declare a variable using _root, you use var, as in:   var varInput;

               

              Use of unnecessary _root references is a poor practice, and is seemingly widespread.

              1 person found this helpful
              • 4. Re: targeting variables on different timelines
                handfeed Level 1

                Thanks for the quick responses.   Ned, I haven't replied until now, I think you're referring to relaxatraja's response.  I'm in an online college beginning Flash course, with one small chapter (1 week) on ActionScript, and your replies are so far above anything explained in the book that I'm assuming I've completely misunderstood the assignment, because of the way I'm trying to do it.

                 

                Thanks again for responding, sorry for any confusion.

                • 5. Re: targeting variables on different timelines
                  Ned Murphy Adobe Community Professional & MVP

                  You're welcome.  There was no confusion.  I was replying to relaxatraja who for some reason was responding to my posting, and was echoing what I was offering.  I don't know why some people do that.

                  • 6. Re: targeting variables on different timelines
                    relaxatraja Level 5

                    Sorry Ned, Anyone can help to solve the problem. You were explained the thing well, but I make it clear with the script. Itz happening all over the forums. Not by some people. Even you replied some posting too. So, dont blame others. Everybody here to help!

                    • 7. Re: targeting variables on different timelines
                      Ned Murphy Adobe Community Professional & MVP

                      Then please repsond to the person you are answering, not just the last posting you see.  When you respond to my posting you come across as if you are trying to correct something I said.  That is not a proper thing to do unless there is something wrong with what I said and that is your intention.  There are courtesies in forums that you should follow.

                      • 8. Re: targeting variables on different timelines
                        relaxatraja Level 5

                        Yup! thanks. I'm new to the forum, I came to know we should click the reply button for the relevant post. becoz some other forums structured in a different way. Anyway thanks for pointed it, it was my mistake by clicking on the reply button of your post. I will learn from mistakes never do it again. Always welcome.