3 Replies Latest reply on Mar 24, 2007 2:57 AM by Greg Dove

    how to save bandwidth on loadMovie

    nehcdet
      I have written a slide show flash app. On the app, there're 100 viewable movieclips on a scrollpane to load 100 slides. I have one swf that has 100 frames with 1 slide on each frame. The app will load this swf and load 1 frame onto 1 movie clip.

      My question is
      1. is there anyway to load a specific frame instead of an entire swf
      2. if 1) is not doable, can i load the swf into memory once, and pass the same object to 100 movieclips to load. If there is a solution like this, is there any memory usage concern.

      Thanks,
      Ted
        • 1. Re: how to save bandwidth on loadMovie
          Greg Dove Level 4
          Not sure if I understand exactly what you're doing for the slide show, but I think I can answer your questions.

          1. You can't load part of a swf... so no to 1. You can obviously goto a specific frame once its loaded, but you can't only load that frame.
          2. And you can't duplicate a loaded movie clip...Excerpt from liveDocs for MovieClip.duplicateMovieClip:

          If you used MovieClip.loadMovie() or the MovieClipLoader class to load a movie clip, the contents of the SWF file are not duplicated. This means that you cannot save bandwidth by loading a JPEG, GIF, PNG, or SWF file and then duplicating the movie clip.

          If the swf is in the browser cache after the first load then it shouldn't cause multiple hits on the server if you do further loads into other movieclips...but I can't answer your question as to what that might do in terms of memory usage.. I haven't tried anything like that and you'd need to test it. If its an issue you might want to rethink the way you display what you have.

          Are the always going to be in this format..? Maybe you could have three movieclips with the same 100 frame swf loaded on the screen for example... and a scrollbar. Have the clips gotoAndStop() on a different frame depending on the scrollbar postion everytime it moves. the central clip for example would be frame x , the top one frame (x-1), the bottom one (x+1). That would only require the clip to be loaded three times instead of 100 times and would give the impression of scolling through the slides...
          • 2. Re: how to save bandwidth on loadMovie
            nehcdet Level 1
            Thanks for the explanation, gwd. I was also thinking about the browser cached instance might help me provided i complete my first loadMovie before starting on all other loads.
            Your suggestion for using only 3 movieclips is also very interesting! I may be able to apply it on my application. I'll give it more thought.
            Thanks for all your recommendations and pointers. I found every single one very insightful.

            • 3. Re: how to save bandwidth on loadMovie
              Greg Dove Level 4
              Yes, its probably a good idea to wait for the first load before initiating the other loads of the same clip.... Here's something else I discovered only yesterday as a concept: http://www.actionscript.com/Article/tabid/54/ArticleID/Preloading-Files-into-the-Browser-s -Cache/Default.aspx .

              You probably don't need to use this Class but you might like to at least be aware of the "trick" with the loadVars option if there's no cross-Domain requirements. Its essentially an intentional fail of a loadVars load to force the file into the browser cache (but not guaranteed - depends on user's browser settings of course)... i.e. this works without loading the swf into a movie clip even once. Its not perfect though.. (user browser settings is one pitfall for example) read through the comments.