Solved

Skip preloading if movie is already downloaded

Posted on 2010-09-23
8
283 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now