all groups > flash actionscript > march 2007 >
You're in the

flash actionscript

group:

how to save bandwidth on loadMovie



how to save bandwidth on loadMovie nehcdet
3/23/2007 10:46:17 PM
flash actionscript: 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
Re: how to save bandwidth on loadMovie GWD
3/23/2007 11:14:00 PM
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...
Re: how to save bandwidth on loadMovie GWD
3/24/2007 12:00:00 AM
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.
Re: how to save bandwidth on loadMovie nehcdet
3/24/2007 6:21:53 AM
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.


AddThis Social Bookmark Button