Solved

Skip preloading if movie is already downloaded

Posted on 2010-09-23
8
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Chrome - Where is "Enable Resource Tracking" 2 12,648
Web browser crash when play videos 24 459
How do I have music file play continuously on a website? 6 112
CD Rom not playing 13 88
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

738 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