Solved

Skip preloading if movie is already downloaded

Posted on 2010-09-23
8
287 Views
Last Modified: 2013-11-11
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
Comment
Question by:truromeo4juliet
  • 5
  • 3
8 Comments
 
LVL 2

Expert Comment

by:phodges4
ID: 33748364
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
 
LVL 5

Author Comment

by:truromeo4juliet
ID: 33748862
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
 
LVL 2

Expert Comment

by:phodges4
ID: 33748919
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 5

Author Comment

by:truromeo4juliet
ID: 33749008
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
 
LVL 2

Accepted Solution

by:
phodges4 earned 500 total points
ID: 33749132
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
 
LVL 5

Author Comment

by:truromeo4juliet
ID: 33750416
should the if !IE section still have button three in the object data:

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

?
0
 
LVL 5

Author Comment

by:truromeo4juliet
ID: 33750436
nevermind, got it! Thanks so much for the help :)
0
 
LVL 5

Author Closing Comment

by:truromeo4juliet
ID: 33750441
Thanks so much.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash player plugin 13 7 339
Firefox fullscreen video lags 4 171
how can flash builder 4.X version make use of java 8 5 353
Running Mp4 or Flash Video 1 128
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question