4 Replies Latest reply on May 30, 2008 9:09 AM by j9lemmon

    preloading a SWF for playback later

    j9lemmon Level 1
      I have a large SWF (1.5mb with lots of bitmaps) that will not be played until almost the end of my main movie. I'd like to preload it when the visitor loads the main SWF, but I don't want it to play until the visitor arrives at the final frame of the main SWF. When I use LoadMovieNum to preload the large SWF, it starts playing immediately, which I don't want.
      I'm targeting Flash Player 6 and using actionScript 1.0
      Any suggestions?
        • 1. Re: preloading a SWF for playback later
          248275 Level 1
          Try this out:
          create two seprate frames (1st and 2nd of timeline), in first frame give this script:
          lbt = this.getBytesLoaded();
          tbt = this.getBytesTotal();
          if(lbt==tbt){
          gotoAndPlay(3);
          }

          and in the second frame:
          gotoAndPlay(1);
          • 2. Re: preloading a SWF for playback later
            j9lemmon Level 1
            Thanks for this response.
            The 'this.getBytesLoaded' is the code I'm using for the main SWF. But I also have a second SWF (finale.swf) that I want to preload in the background, while the visitor is viewing frame 3 of the main SWF.
            So I'm figuring I need to start preloading finale.swf on frame three of the main SWF, but I don't want finale.swf to play until the final frame of the main SWF. My goal is to have the finale.swf completely preloaded so that when the visitor reaches the final frame of the main SWF, the finale.swf will play immediately without waiting for it to download.
            Thanks for any thoughts.
            • 3. preloading a SWF for playback later
              Ankur Arora Level 1
              Instead of using loadMovieNum create a empty movieclip in your main fla file. Assign a instance name to this movie clip and use movieClipInstance.loadMovie("bigFile.swf");. You can use MovieClipLoader class to check the progress of loaded content and then use onLoadProgress event to set movieClipInstance._visible = false;

              Please let me know if I'm not clear and send me the FLA file you are using. I'll make changes to the code.




              Thanks & Regards
              Ankur Arora
              Project Leader(Flash and Flex)
              http://flashdeveloper.blogspot.com
              let your thoughts fly to others... you will become rich.

              • 4. Re: preloading a SWF for playback later
                j9lemmon Level 1
                Thanks, I'll give this a try.