4 Replies Latest reply on Dec 14, 2009 11:23 AM by Rothrock

    Movie Variables

    OblivionKnight Level 1
      Hi,

       

      I hope you can help me. I expect it's a straight forward question.

       

      I'm using a Flash accordion component. This component is made of movies and includes text boxes whiach people can enter locations into.

       

      These values are processed on the main stage on the click of a button.

       

      My question is, how do i get the value that was entered in the accordion movies into a variable on the main stage that the can be used.

       

      At the moment i have a text box on the page, and have added this code to the first frame. Although i think the value is stuck within the movie and cant be accessed on the main stage.

       

      keyword = varkeyword

       

      Any help or advice is gratefully recieved.

       

      Thanks
        • 1. Re: Movie Variables
          Saransoft84

          Hi,

           

          Better you assign the value to the SharedObject in flash.

           

          Saransoft

          • 2. Re: Movie Variables
            OblivionKnight Level 1

            Thanks for the reply. I have googled share objects and its seems rather excessive to read a variable from a movie on the stage.

             

            Wouldnt something like

             

            _root.user = _root.movieclipname.name;

             

            be better. I'm not sure what the syntax should be. But there are many references to reading variables in movies using global or root variables. I just cant figure how

             

            In short a text box sits in a movie on the stage and I need to get the data from the text box into another variable on the stage.

             

            • 3. Re: Movie Variables
              Saransoft84 Level 3

              Hi,

               

              Yes u can assign like that. or SharedObject is better.

               

              As per ur convenient.

               

              var my_so:SharedObject = SharedObject.getLocal("kookie");

               

              my_so.data.user = _root.movieclipname.name;

               

              Saransoft

               

              • 4. Re: Movie Variables
                Rothrock Level 5

                Shared object could work, but you are correct in that it really isn't appropriate at all for this purpose. Not to say that it is possible for a user to turn off shared objects and then your code won't work at all. Shared objects are like cookies in that they are really for saving persistent data from session to session and there really is no call for that here.

                 

                How are you adding things to your accordion? And have you given your accordion instance a name?

                 

                I put an accordion on the stage and gave it an instance name of acc. I then used the following code to add a movieclip to it.

                 

                import mx.containers.Accordion;

                var acc:Accordion;

                var s=acc.createSegment("Stuff","stuff","Stuff");

                 

                I can then access the contents of that clip via:

                 

                trace(s.someProperty)

                trace(acc.stuff.someProperty)

                 

                Those are both the same.

                 

                Off course if you were really hard core about this, you would make your movies have some kind of function that collected and processed the information contained in them. And then your main timeline could do something like:

                 

                s.getInformation()

                 

                But that might be too much depending upon your needs.