Link to home
Start Free TrialLog in
Avatar of truromeo4juliet
truromeo4julietFlag for United States of America

asked on

Skip preloading if movie is already downloaded

I've got a preloader that was programmed by someone else... the problem is that the movie that it's loading appears on 5 different pages of the same site, and it's forcing the movie to redownload itself every time. I just need a way for it to skip the download if the file is already in cache. I thought this could be done using a simple if-statement to check if the bytes loaded equaled bites total, but it didn't work. Some assistance would be nice :) Thanks
onClipEvent (load) {
	total = _root.getBytesTotal();
}

onClipEvent (enterFrame) {
	loaded = _root.getBytesLoaded();
	percent = int(loaded/total*100);
	text = percent+"%";
	gotoAndStop(percent);
	if (loaded == total) {
		_root.gotoAndPlay(2);
	}
}

Open in new window

Avatar of phodges4
phodges4

are all 5 pages within the same swf file? or are they 5 different web pages? The only way you will be able to stop redownloading is if the loader is in a swf and that's all located on one web page .. also, if the file is in cache, it wont physically download the file again so there is no harm in that unless you want to skip an animation or something.  

please post the code that loads the external swf..

If you are just trying to skip an animation you can do a simple check in the loader to see if the percentage is ever anything less than 100 and if it is, gotoAnPlay() passed the animtion..

if you need some examples let me know .. or if I'm wrong please better specify the problem .. thanks
Avatar of truromeo4juliet

ASKER

it's all one swf file... it's an HTML site (6 html pages in all), each page has the same SWF embedded into it... for some reason, each page, the first time I go to it, has to load the SWF... afterwards, it loads from cache when i revisit that particular page... Is there any reason for this?
hmmm .. that's a strange one, the cache should have picked up the same file as long as the URL is the same  .. do you have this posted anywhere on the interwebs so I can sneak a peek?
http://permanentmakeupbyadriana.com/

the only difference per page is that each page is referenced by the swf file to tell it what button should be highlighted in the SWF. You can see in the website.
ASKER CERTIFIED SOLUTION
Avatar of phodges4
phodges4

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
should the if !IE section still have button three in the object data:

<object data="flash/header_v8.swf?button=3" etc...

?
nevermind, got it! Thanks so much for the help :)
Thanks so much.