LoadBar shows running to 100, although external SWF is in cache (F5/preloader)

Hi all,

On Actionscript I found this really cool smooth preloader ( http://www.actionscript.net/tutorials/beginner/Smooth_PreLoader/index.shtml )… and it works well till a certain extend.

In my example you see a pink button. This button sets the to be loaded SWF in a var and commands the Cover Over image to play (cover). After the Cover MC had reached the over-state (frame 15), there is a loadBar + an action giving a loadMovie command (it needs to be loaded into a MC called content)

Attached to the loadBar MC, there is the preload script attached:

onClipEvent (enterFrame) {
loading = _root.content.getBytesLoaded();
total = _root.content.getBytesTotal();
percent -= (percent-((loading/total)100)).25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_root.content.gotoAndPlay(3);
_root.cover.gotoAndPlay(16);
}
}

and it works as you can see.

However, contrary to what you expect, when you click the second time (SWF should be at least in cache), it again plays the entire loadBar moving to 100%, while it would be more logic that it would appear as a short flash before the external SWF shows (since bytesloaded should be quickly equal to bytestotal)…

So I want that whenever the user would decide to view the image again, it will appear immediately, instead of showing the entire preload sequence again.

I was thinking about using vars, but I don’t think it is possible, since we are talking here (in the real movie, not this example) about many different external SWFs, and i cannot know which one the user decides to view, neither do i want to use more than one preloader…

So is there a way around this, and if so, how?

Thanks a lot!

Example page:
http://www.e-llumination.net/kirupa/preloader2kirupa.html

The fla:
http://www.e-llumination.net/kirupa/preloader2kirupa.fla

Hi ericinho,

A peek at this thread will help you solve the problem, tho’ you will have to read to the end to get the answer.

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=25874&highlight=cached+swf

Hope it helps

SteveD