5 Replies Latest reply on Jul 20, 2006 10:08 AM by Newsgroup_User

    Passing information between two SWF

    Newt99

      Hello,

      I have three movies. A loader SWF that loads an intro SWF where the user makes a selection. Then a main SWF where the selection of the first SWF should be used. I load my movies at level 0 using loadMovie("homepage.swf", _level0);

      Loading works. I tried everything to pass on the selection between the intro SWF and the main SWF but to no avail:

      - Using a SharedObject
      - Locking the _root and using _level0.variableName to store the selection

      None of these worked.

      - Should I load the movies into a different level than _level0 then use _level0 to store the variable ?
      - Can I pass on information using a SharedObject between two SWF ? How ?

      Thanks,
      Karl.
        • 1. Re: Passing information between two SWF
          micahkoga Level 1
          You could also try storeing a global variable to pass info between movieclips:
          _global.varname = somevalue;
          • 2. Re: Passing information between two SWF
            coreysyms
            sharedObject works the best... here is the best tutorial out there, post code if you still have errors.

            http://previous.emllabs.com/article.php?articleId=110

            • 3. Re: Passing information between two SWF
              Peter Lorent Level 2
              Hit F1 and search for LocalConnection.
              • 4. Re: Passing information between two SWF
                Newt99 Level 1

                I had actually tried to use _global, but with no results. Seems that the _global variable value is not maintained between SWFs. Maybe the fact to load a SWF at _level0 makes all global variables reset (and I have to use _level0 since I use funky other stuff like container layer resizing).

                I will try the LocalConnection and will read the tutorial about SharedObjects.

                Thanks for your guidelines,
                Karl.
                • 5. Re: Passing information between two SWF
                  Level 7
                  "Newt99" <webforumsuser@macromedia.com> wrote in message news:e9o9qr$hp7$1@forums.macromedia.com...
                  > I had actually tried to use _global, but with no results. Seems that the
                  > _global variable value is not maintained between SWFs. Maybe the fact to load a
                  > SWF at _level0 makes all global variables reset (and I have to use _level0
                  > since I use funky other stuff like container layer resizing).
                  >
                  > I will try the LocalConnection and will read the tutorial about SharedObjects.
                  >
                  > Thanks for your guidelines,
                  > Karl.
                  >

                  localConnection is only used when two or more swf files are run seperately from each other like when you have swfs in different
                  spots on an html page.
                  If one swf loads another swf then you don't use localConnection for that.

                  sharedObjects could be used if you have to keep loading everything into the same level, but then there shouldn't be any reason to do
                  that. As long as you don't load one swf into the same level is another swf then you won't overwrite the variables for that level.
                  If you use seperate movieclips or levels then any movieclip or level can refer to the timeline variables of any of the others...

                  _level0.someVariable
                  _level1.someVariable
                  _level1.someMovieClip.someVariable
                  etc.
                  tralfaz