Yeah, this should be real simple, considering I’ve created more complex preloaders in my sleep. But…
I’m having various issues with a preloader situation within an image gallery. I simply want to check if the next image (12 frames ahead) has loaded before I transition to it by playing the timeline. If the image isn’t loaded, I want to play a little movieclip to indicate feedback until the image is ready, then allow playback to advance.
Anyone kind enough to offer a suggestion or two on how to do this as cleanly as possible? Thanks!
If it is all in 1 movie, then a preloader in the beginning of that movie will preload all content within that movie.
Where if you were dynamically loading the images (such as the image gallery tutorial on this site), you would need to use a dynamic preloader (code included in code in tutorial, although not implemented by default).
Thanks, lostinbeta, but I already have a preloader at the beginning of the movie that loads up to a certain number of bytes. This additional “mini-preloader” is merely intended to be a safeguard for those folks who zip through the gallery and don’t have fast connections. I don’t want them getting stalled in the middle of transitions from one image to another.
For some reason or another, I’m having a heck of a time getting it to behave…
*Originally posted by Johnny Blane *
**Thanks, lostinbeta, but I already have a preloader at the beginning of the movie that loads up to a certain number of bytes. This additional “mini-preloader” is merely intended to be a safeguard for those folks who zip through the gallery and don’t have fast connections. I don’t want them getting stalled in the middle of transitions from one image to another.
For some reason or another, I’m having a heck of a time getting it to behave… **
Why do you only load up to a certain number of bytes? Why not just load the total bytes ( via getBytesTotal() ) and that way your entire movie will preload and no matter what connect it should work fine (it would be up to the users system on how fast it would work).
Your movie will lag if you don’t preload the whole thing, so preloading only part of it will do just that… show a preloader for only part of it, but while it is playing the rest will be loading in the background, which causes lag and is quite inefficient.
Mainly because we’re talking multiple image galleries (residing in multiple SWFs), some of which are 800K-1MB in size because they contain upwards of 40-50 jpegs. I don’t want 56k users seeing a 2 minute preloader 12 times.
So I’m loading about 10 images initially, which for 90% of visitors will be fine. What I’m trying to safeguard against are those instances when someone flies through the gallery at a faster-than-usual pace.
If they do that, I’m just looking to keep them on the current frame while a wait icon appears, allowing time for more of the movie to load before they continue.
Can you post a link of where this was done before?
You can’t do this all in 1 movie. You could add a seperate preloader to each individual .swf that will preload all those images, or you can use a dynamic preloader to preload each image individually, but you can’t put all the images in one movie and control what loads and what doesn’t at what time.
There are a few things on dynamic image preloaders on the forum so a search might be useful.
Thanks for taking the time to tackle this with me. Maybe I haven’t been clear in my description of the situation. Let me just explain in the context of a single SWF.
Let’s say the file is an image gallery consisting of 50 images. There’s a 12 frame sequence that transitions between each image. At the very beginning of the file I have a preloader that loads x number of bytes before continuing. In this example, let’s say that the number of bytes loaded is equal to about 10 images. That provides a more than adequate buffer for someone who’s advancing through the gallery at a normal pace, meaning that by the time they get to image 10, another 8-10 have probably been loaded. To these folks, the whole process works flawlessly, without them having to wait 2 minutes at the outset for EVERYTHING to load.
But… if you have a slower connection and you just breeze through the gallery by clicking the next button indiscriminately, it’s entirely possible you’ll bump into the point where the movie is still loading (say at frame 15, or 18, or 25 ? wherever).
What I want to do is create a mini-preloader as a back-up. These preloader would exist between every image. If they’re on frame 100 looking at an image and the next image at frame 112 isn’t loaded for some reason, I’d like to keep them on 100 with a little progress icon until it’s safe to advance through the transition. What I DON’T want to have happen is they get to frame 111 (at the tail end of the transition) and are then stalled while the next frame finishes loading.
Does this make any more sense? If not, I’m looking for a site that I can use as an example.
Yeah, I understand that, but I was saying that it is inefficient to only load part of the movie then play it because since the movie doesn’t stop loading it will load in the background, and if the movie is loading in the background it causes a lot of lag on a viewers system sometimes.
If you do choose to do this I suppose on whatever frames you want you can check how many bytes are loaded so far (via getBytesLoaded()) and if it past whatever point you want then continue, and if not, then keep at that frame (which can have a loading animation or something on it) just like a regular preloader only on a later frame.
Actually, thanks to both of you for the time you took replying, but I kept at it and finally got it pegged. I plan on putting up a site check request in a few days, so y’all can see what I was babbling about.
For lostinbeta specifically, your presence around here is invaluable. 14301 posts as of this second? Absolutely incredible.