Force SWF files to refresh with page, not load from cache

I'm working on a Flash portfolio that dynamically loads JPGs from a folder. Users can upload new files to the folder. Only problem is that (using IE) if you go back to the player page after uploading, it displays the previously cached SWF and you don't see the newly uploaded images. I'd like to force the page to re-upload the revised SWF.

Looking through EE, Macromedia support and MS support, I've seen several claims that adding these to the header will solve the problem:

<META HTTP-EQUIV="Expires" CONTENT="Mon, 04 Dec 1999 21:29:02 GMT">  (any old date)
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Expires" CONTENT="-1">

Of course, I'm posting to EE in a panic because these lines are apparently NOT preventing IE from displaying the cached SWF and I'm under the gun to get this fixed.

The slideshow is on a plain ol' HTML page, not dynamic.

I'm "just a designer," not a programmer, and not very advanced when it comes to ActionScript. Can someone provide a *simple* fix? This must come up all the time, but I haven't found a simple solution that works yet...

Thanks!
LVL 4
slovisaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CyanBlueCommented:
Howdy...

If your page is static, the only option I can think of is using the JavaScript to generate an unique number to append to the SWF file name like this...  You will need to use document.write() to append the variable like that...

<SCRIPT LANGUAGE="JavaScript">
<!--
now = new Date().getTime();
//document.write(now + ' <br> ');
//-->

document.write('<OBJECT ... ... ');
document.write('<param name="movie" value="FIle.swf?rnd="' + now + ' />');
</SCRIPT>

CyanBlue
0
slovisaAuthor Commented:
This looks like a good solution - I've tried something similar in ActionScript, using a loader swf to add a variable to the loadMovie parameter. Didn't have much luck with that, but I would definitely like to try this method.

I don't know much about JS. I've tried inserting this in my page, both literally and trying to add/replace my specific object and movie names. Either way, it breaks my page. What might I be doing wrong?
0
CyanBlueCommented:
You won't see much difference if you are applying that technique on loadMovie() function if you have only one SWF file you are keep reloading...
If you are trying to initiating the loadMovie() function each time with different argument, you could try this...

now = new Date();
loadMovie("some.swf?uniqueID=" + now.getTime());

Let me know how it goes...  ;)

CyanBlue
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

slovisaAuthor Commented:
Again, I'm no programmer by any means... I don't even know if that's JavaScript or ActionScript. Can you tell me specifically what to place where, and what I need to change aside from the name of the swf?
0
CyanBlueCommented:
Um...  Okay...  You said this...

'using a loader swf to add a variable to the loadMovie parameter.'

Can you show me the script that you have to achieve that???

CyanBlue
0
slovisaAuthor Commented:
The JavaScript solution would be fine, if you could explain it to me.

If ActionScript would be easier, here are three loader methods I found online. None of them has worked for me:

unique=new Date().getTime();
this.loadMovie("portfolio1.swf?list=10&unique="+unique);

noCache = Number(new Date());
loadMovieNum("portfolio1.swf?noCache=" + noCache, 1);

loadMovie("filename.swf?Ran" + random (99999999), target_mc);

Thanks for your help!
0
CyanBlueCommented:
Hm...  Maybe there is something else going on in your code...  As far as I can tell, any of what you have should work fine to load the fresh portflio1.swf everytime... (and JavaScript solution is not what you are looking for in this case because you are talking about multiple SWF files whish should be taken care of from within the Flash...)

Do you have the site up somewhere where I can take a look???

CyanBlue
0
slovisaAuthor Commented:
Well, I haven't implemented any of these solutions since they're not working, but here is the SWF in action (with no loader/random variable swf mediating...just the main SWF): http://www.bringneworleansbackuic.com/group4/

The slideshow itself is a standard Flash MX component called load_images.FLA, found in the samples folder - but we modified it to read the images dynamically. It calls a file called "count.php" to read all the JPEGs that have been uploaded to a certain directory, then displays all of the images (rather than a fixed number, as it does "out of the box").  The idea is that users can upload their own images, then go back to the viewer and see them in the slideshow. The slideshow starts with the most recently uploaded image. But, since IE reads the SWF from cache, users don't see the newly uploaded images at all unless they clear their cache.

Let me know if seeing that in action helps. I would be happy to upload a page that uses one of those random variable loader solutions, but it doesn't turn out looking any different.

(If you test the upload function, please use a very benign image. It is live and others will be looking at it. I can delete your images later.)

Thanks again.
0
CyanBlueCommented:
So, you don't actually have multiple SWF files to play with...  and you are reloading the SWF file any time you upload the image...  Then, JavaScript is going to be the one you will need to use...  Try this...

Find this block and comment them out...

<object type="application/x-shockwave-flash" data="portfolio4.swf" width="504" height="335">
<param name="movie" value="portfolio4.swf" />
</object>

Replace them with this block...

<SCRIPT LANGUAGE="JavaScript">
<!--
now = new Date().getTime();
//-->

document.write('<object type="application/x-shockwave-flash" data="portfolio4.swf?now="' + now + ' width="504" height="335">');
document.write('<param name="movie" value="portfolio4.swf?now="' + now + '" />');
</SCRIPT>

and see if this works...

Oh, if you can, add a small textField at the bottom of the page with the variable name set to 'now' and republish the SWF file...  If you do that, you are sure to know, since it is visible, that that value gets passed & changed when the page loads next time...

CyanBlue
0
slovisaAuthor Commented:
Well, I implemented your changes (minus the textField at the bottom) but:
     (a) it breaks the page, and
     (b) I'm guessing that it might not work because I manually uploaded a new image via FTP (since the upload link is missing) and the image does not appear in the slideshow when you refresh the page. (It does appear if you clear your cache, then refresh.)

Here is the revised page: http://www.bringneworleansbackuic.com/group4/jstest1.php

Any other ideas?
0
CyanBlueCommented:
Well...  I think this is pretty much what I can do to help without going over what you have... (Or my JavaScript is not that great...  :D)

If you want, you can send me the appropriate files(jstest1.php, portfolio4.swf, count.php) and I can take another peek at it, but that's up to you...

Just out of curiosity, what is the connection between you and the UIC???  :)
I was attending UIC for several semesters and moved to Columbia College in downtown but I lived five minutes from the UIC for four years while I was in Chicago...  Good old days...  :)

CyanBlue
0
slovisaAuthor Commented:
Sure, if you're willing to look at the files I can send them. It would be much appreciated. What's the best way to get them to you?

Sorry to say there's no real connection between me and UIC, other than I'm helping someone put this mini-site together. I'm a Champaign-Urbana grad, though, and have lived in or near Chicago all my life.
0
CyanBlueCommented:
You can find my email address if you check my profile...

Well...  I am now living in VA, so Urbana Champaign sounds fairly close...  :D

I cannot promise to fix this but I sure can take a look, so send me the files...

CyanBlue
0
CyanBlueCommented:
Okay...  In the FLA file...  

Find this line...

varObject.load("/images/group4/count.php");

Replace it with this line...

varObject.load("/images/group4/count.php?uid=" + getTimer());

This hsould be the correct content in the jstest1.php file...

                  <SCRIPT LANGUAGE="JavaScript">
                  <!--
                  now = new Date().getTime();
                  //-->

                  document.write('<object type="application/x-shockwave-flash" data="portfolio4.swf?now=' + now + ' " width="504" height="335">');
                  document.write('<param name="movie" value="portfolio4.swf?now=' + now + '" />');
                  document.write('</object>');
                  </SCRIPT>

Let me know how it works...

CyanBlue
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slovisaAuthor Commented:
Fantastic. That does it!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.