6 Replies Latest reply on Oct 15, 2007 5:08 PM by LWAA

    playing a second swf when the first one's finished

    LWAA Level 1
      I have 2 swf files (the FLA's too) and want one to play then the second. - I'd add the second to the timeline of the first, but the second is a complete site and contains many referenced "gotoandplay" links which would all need changing. So....I really just need a way for the second swf to play after the first one's finished. I tried using the load external movie clip behaviour, but couldn't make it work. Can I use the first swf as a preloader without affecting the timeline on the main swf? I canspare a couple of frames at the start of the second movie for that, but don't know how to set it up - can anyone help?

      I also want the custom cursor to remain only in the first swf, and go back to default on the second.

      main (second) movie: http://mysticalbillyo.com
      first movie: http://mysticalbillyo.com/intro.swf
        • 1. playing a second swf when the first one's finished
          What version of flash/AS?

          If using 3.0, at the beginning of your intro movie you can use this:

          var mainMovie:Loader = new Loader();
          mainMovie.load(new URLRequest("mainMovie.swf"));

          Which will load the movie into a variable but not display it.

          At the end of the intro.swf you can:


          which will put the new movie on top.

          if your main site takes a while to load you can get creative and track the loading. you can add a skip button that goes to the last frame of the intro movie which causes the main site to load. you can pretty much do anything
          • 2. playing a second swf when the first one's finished
            clbeech Level 3
            I think you may want to create a 'master' loading swf, rather than loading the second movie into the first, and use the MovieClipLoader class to call and load new movies into the master container.

            Set up a new swf, that is the same size as the others. you'll set up a function on the first frame and then use that function to load all subsequent content into the master document. You can also use methods of the class to add things like preloaders and other event handlers. so for instance, at the last frame of the intro swf, you'd add a 'call' to the function in the master telling it to load the next movie in the sequence. I'll add the call you will need on the bottom of the code example below.

            PS. ------------------------------------
            I'm not one to solicit, however I have (awhile ago) developed a Component that you may be interested in for your site, although it has not been package and ready for distribution, it does function - called 'glitterMouse', and produces a twinkling mouse trail effect when you move the cursor, mush like the onRollOver animation that you'd painstakingly made (ouch) except that it use random twinkle generation at run-time, and has many property settings, like color, quantity, gravity, and so on. It might be a nice addition to your 'wand' cursor, and would not 'replace it' as it's not a 'cursor' but an effect generator.

            If you are interested, an example of it in action (although you can't purcahse it from there ... yet) can be seen on my site at: www.beechstudios.com goto the 'Flash' section, it's the first one listed.

            Just thought I'd throw that out there, sorry all, it just fits :]

            OK the code for you, add this to the first frame of the 'master' swf, then add the code at the bottom to the end of the intro swf in the last frame.

            EDIT: this is AS2 code, to use AS3 code do something more like the methods as described above, yet I would still consider placing all content within a 'master' loading doc, and replaceing or removeing previously loaded children.
            • 4. Re: playing a second swf when the first one's finished
              LWAA Level 1
              thanks - it loads and plays the first one, but doesn't move on to the second......only, sometimes when I reload the page it goes straight to the second swf!

              • 6. Re: playing a second swf when the first one's finished
                LWAA Level 1
                this is what is in 1.swf which is the swf you access at index1.html:

                var mc = this.createEmptyMovieClip('mc', 0);
                var mcl = new MovieClipLoader();

                function loadSWF(file) {
                mcl.loadClip(file, mc);


                //:::::::::::::::::::::CODE FOR THE 'intro.swf' file last frame