5 Replies Latest reply on Sep 15, 2009 3:11 PM by Ned Murphy

    Loading .swf file into .swf loaded through movieclip

    Reign717

      I'm using loadMovie("folder/file.swf", "_root.host"); to load the first swf file into a blank movieclip named 'host'.  When I try using the same code it loads the other swf file, it just closes the first one.  I want to have it as more of a popup that can be closed without affecting the original swf file. please help

        • 1. Re: Loading .swf file into .swf loaded through movieclip
          Ned Murphy Adobe Community Professional & MVP

          loadMovie() replaces the target movie with the loaded movie, so what you will want to do is use the MovieClip.createEmptyMovieClip() method to first add a child movieclip that you can load the second file into.

          1 person found this helpful
          • 2. Re: Loading .swf file into .swf loaded through movieclip
            Reign717 Level 1

            I'm still a novice at this so I'm not sure what I'm doing just yet.  I've haven't used the createEmptyMovieClip function yet so lemme see if I've got this straight.  I can do something like

             

            on (release) {
                MovieClip.createEmptyMovieClip("folder/file.swf", "_root.host");
            }

             

            and just create another 'host' movie clip in the second flash file?

             

            ps-thanks for the quick response, it's nice

            • 3. Re: Loading .swf file into .swf loaded through movieclip
              Ned Murphy Adobe Community Professional & MVP

              Here's more along the lines of what I was saying... you load your first movie the same way as you were...

               

              loadMovie("folder/file.swf", "_root.host");

               

              Then you add an empty movieclip to that swf...

               

              _root.host.createEmptyMovieClip("secondMC", _root.host.getNextHighestDepth();)

               

              Then you load your second movie into that created MC...

               

              _root.host.secondMC.loadMovie(....

               

              And your second movie assumes the life/identity of the empty mc you created.

               

              Hopefully I'm not off target of what you intend.

              1 person found this helpful
              • 4. Re: Loading .swf file into .swf loaded through movieclip
                Reign717 Level 1

                Thanks Ned, that was almost exactly what I needed.  Its given me a few other issuses but I'm going in the right direction now.  I wound up using:

                 

                _root.host.createEmptyMovieClip("secondMC", _root.host)

                 

                as the actions on my frame and:

                 

                on (release) {
                    loadMovie("folder/file.swf", "_root.host.secondMC");
                    }

                 

                on my button, and that seemed to work.  Now I've got a few other questions but lets start small.  I was wondering if theres a way to load that movieclip in a predetermined spot instead of the top left of the frame.  Also, before I was using

                 

                on (release) {
                    unloadMovie("_root.host");

                }

                 

                for my close buttons.  It still works well for the first swf file, but the button on the new one that's loaded isn't working.  I've tried a number of things like:

                 

                unloadMovie("root.host.secondMC");

                unloadMovie("secondMC");

                unloadMovie("secondMC", "_.root.host");

                 

                and I haven't found anything that works.  please help

                 

                ps - can you recommend a good tutorial site that might have some of this?

                • 5. Re: Loading .swf file into .swf loaded through movieclip
                  Ned Murphy Adobe Community Professional & MVP

                  I've always had issues when it comes to properly coding the removal of loaded movie, and trial and error is what usually ends up working for me... I wish I had a better recipe to offer you...  One thing though, unloadMovie("root.host.secondMC");... should be "_root", in case that wasn't a typo.  Also, I do not remember if you should be quoting the argument....  You might try....

                   

                  unloadMovie(_root.host.secondMC);

                   

                  ... without the quotes... While the argument can be either an instance or a string representation of the instance, it's possible the path shouldn't be in the string