Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

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

0
truromeo4juliet
Asked:
truromeo4juliet
  • 5
  • 3
1 Solution
 
phodges4Commented:
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
0
 
truromeo4julietAuthor Commented:
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?
0
 
phodges4Commented:
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?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
truromeo4julietAuthor Commented:
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.
0
 
phodges4Commented:
it's because of the querystring variable .. you can fix this by moving button=3 into the flashvars property
(note i put flashvars in there twice)
you can check http://kb2.adobe.com/cps/164/tn_16417.html for more info on flashvars

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
           codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
            width="766" height="414">
    <param name="movie" value="flash/header_v8.swf"  />
    <param name="quality" value="high"  />
    <param name="flashvars" value="button=3"  />
    <param name="menu" value="false"  />
    <!--[if !IE]> <-->
    <object data="flash/header_v8.swf?button=3"
             width="766" height="414" type="application/x-shockwave-flash">
     <param name="quality" value="high"  />
     <param name="flashvars" value="button=3"  />
     <param name="menu" value="false"  />
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"  />
     FAIL (the browser should render some flash content, not this).
    </object>
     <![endif]-->
   </object>
0
 
truromeo4julietAuthor Commented:
should the if !IE section still have button three in the object data:

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

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now