5 Replies Latest reply on May 30, 2006 5:54 PM by nephele_s

    Load movies w/out buttons into main movie

    nephele_s
      The idea is to see one large movie play seemlessly. I would like help with code to load several external swf's into my main movie, but without using buttons -- i.e. I would like them to load successively. After one movie plays I'd like it to empty out of its current level and be replace with the next movie. By breaking it into pieces and loading and unloading sections one at a time, I would avoid a long download time with one big file. Can anyone help me out with the code for this?
        • 1. Re: Load movies w/out buttons into main movie
          2m Level 2
          What you want to do is not so hard, but a basic to intermediate understanding of actionsript would surely help.

          The problem is that you never know exactly when the movie(s) will have downloaded. After some time of downloading you can guess the download rate, and calculate the time it will tale to download all movie(s), but there is no guarantee that the download rate will stay the same all the time.

          If you want to make sure that your movie plays without “re-buffering” it normally makes no difference weather you have it in one part or more smaller parts (might even be vice versa due to fonts and other assets), that is, if your movie just plays linearly. If you have interactive decisions, and might not need certain parts of your movie due to user interaction it is very much advisable to split it apart though.

          [A Flash movie can start playing even if it is not fully downloaded and still download while playing, so determining the time to start playing is the only challenge as mentioned above]
          • 2. Re: Load movies w/out buttons into main movie
            Level 7
            In article <e5i1dp$2u1$1@forums.macromedia.com>,
            webforumsuser@macromedia.com says...
            > What you want to do is not so hard, but a basic to intermediate understanding
            > of actionsript would surely help.

            I'm working on a similar problem with no success, so far...
            In my application a series of swf's that Public Service Announcements
            are to be displayed one after the other on a stand-alone computer.

            The various swf's will change over time (some being reused, others
            added, etc) but it would be nice to have a master swf that we can (in an
            array??) identify each piece of the whole presentation (psa01.swf,
            psa04.swf, etc) and then have them load (pre-loading is ok) and play one
            after the other in a loop.

            Can you lay out an outline of what needs to be done?
            Thanks,

            Steve
            • 3. Re: Load movies w/out buttons into main movie
              2m Level 2
              Hersr what I did:

              place the list of swf's to load in an xml file, load that file, put that list into an array.
              start loading the the first file with MovieClipLoader.
              When this has finished, i delete the first elemrnt of the arrray, and atart over loading the (new) first element of my array

              until there is nothing left to load.

              • 4. Re: Load movies w/out buttons into main movie
                Level 7
                In article <e5i7ef$add$1@forums.macromedia.com>,
                webforumsuser@macromedia.com says...
                > Hersr what I did:
                >
                > place the list of swf's to load in an xml file, load that file, put that list
                > into an array.
                > start loading the the first file with MovieClipLoader.
                > When this has finished, i delete the first elemrnt of the arrray, and atart
                > over loading the (new) first element of my array
                >
                > until there is nothing left to load.
                >
                >
                >
                >
                so then how would you handle the sequential 'showing' of the movie
                clips? what about putting a stop() in frame 1 of each swf and then a
                gotoAndPlay(the next mc-based on a global array holding a reference to
                each mc, frame 2) in the last frame of each swf. ???
                • 5. Re: Load movies w/out buttons into main movie
                  nephele_s Level 1
                  The movies that I want to play one after another are not that large, all are between 250K and 1MB, but there are 10 altogether. There is no interactivity in any of the .swf's. This is just a linear animation which needs to be broken down into pieces because one .swf containing the whole animation would be about 18MB.

                  I have a basic to intermediate understanding of actionscripting, but I'm a designer not a programmer and find some of this difficult. Can someone please tell me if the code below would work?

                  For example if I have a main fla. and it contains an empty movieclip with an instance name MC,
                  on the first frame I add the following code:

                  var files:Array = ["1.swf","2.swf"];
                  var counter:Number = 0;
                  function loadSwf(val:Number):Void {
                  if (counter == files.length) {
                  counter = 0;
                  }
                  if (counter<0) {
                  counter = files.length-1;
                  }
                  MC.loadMovie(files[counter], 1);
                  counter += val;
                  }
                  loadSwf(1);

                  Then create all the swfs I want to load, and in the last frame of each swf, create an empty keyframe and add this code :

                  _parent.loadSwf(1);