How to make Flash Show New Content When Updated

  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

I'm sure there is something I need to do but just don't have the knowledge yet so I'm hoping someone here can give me that Knowledge.

I have made a website and uploaded it to my server, but the problem is when I add new content to the swf file being loaded and upload the updated version to my server, the old content still gets viewed until I go into my browser tools and clear my cache. Now for me I know how to do that but my visitors might not know to do that nor should they have to to see the fresh content.

My question is there away for this not to happen with Actionscript or something, so when you go the pages you get the fresh content with out having to clear out your cache?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

I have still not found a good solution to this I have found several question and so called solutions but all have failed.

To clarify my problem and what I have tried. I have basically 2 different xml files pulling in data to my flash file. Now when I upload an updated xml file with new data and then open my page in flash the new content doesnt get loaded in unless I actually manually clear my cache.

Here is an snippet of code loadin in my xml file.

Code: [ Select ]
var xmlURLRequest:URLRequest = new URLRequest("scoreboard.xml");


now I have read on other forums that doing something like this fixes the problem forcing flash to load in a the new xml file.

Code: [ Select ]
var xmlURLRequest:URLRequest = new URLRequest("scoreboard.xml" + "?r=" + Math.random());


But as I stated this method and other methods have not worked using AS3. So I'm pretty much coming to the conclusion that flash falls back into the days of worthless for designing websites, before it was people on dial up would take for ever to load and with this cache problem visitors would always get old content unless they knew they had to clear their cache ever time they visited your site, and if that is the case I would believe most wouldnt even want to take the time to do that.

Anyway if anyone knows of a solution to resolving flashes cache problem please let me know :?
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Might just want to check your cache settings. I think by default most peoples are set to automatically look for a new version each time. I never have to clear cache after uploading a flash file update. Just refreshing the page works.
  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

not sure that would be a reasonable solution. I'm thinking from the every day Joe user that doesn't know about the cache problem and keeps checking the web site every day and seeing the same content when there is new content to been seen.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Then just add this in the HTML for the flash page inside the head tags

Code: [ Select ]
<meta http-equiv="refresh" content="0; http://www.redirecturl.com/" />
<meta http-equiv="pragma" content="no-cache">
 
<script type="text/javascript">
window.location.replace('http://www.redirecturl.com/')
</script>
  1. <meta http-equiv="refresh" content="0; http://www.redirecturl.com/" />
  2. <meta http-equiv="pragma" content="no-cache">
  3.  
  4. <script type="text/javascript">
  5. window.location.replace('http://www.redirecturl.com/')
  6. </script>


obviously replace the URL above with your webpage.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

you can also use javascript to append a random string of numbers to the end of the swf url so you get something like myflash.swf?id=3421321231 as long as the id is different each time your browser won't cache the file. That said caching is actually very useful in most situations so you might want to be careful how large a flash file you force users to download each time.
  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

Thanks for the replys I think I got it solved sort of to an extent. The site is very small and mainly shows scores and video highlights from my nephews football games. here is the site http://www.stcharlestitans.com.

Anyways what I did was go into the flash buttons and just added a random number function to the end of each link. Then to test it I went into my xml files and just changed some values around to test, and what I found is IE and fire fox handle it differently.

In IE I had to close the browser and reopened and everything would update fine. If I didn't close the browser and just hit refresh nothing would change.

For Fire Fox I could hit refresh and text data such as the score board and record would update fine but videos wouldn't unless I closed the browser and reopened.

So in conclusion as long as data is being updated after a browser is closed and updated after reopened then I guess that is all i can ask for if that is simulating a visitor returning to my site. I will test some more through today and see if there is any problems with this method.

Just for the record if you have any sample code around graphixboy using the javascript method I like to see how that works.

Thanks again
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

ah yeah. I've found that xml files are sometimes the worst to keep from caching. The javascript method is pretty much the same as the thing you did in flash and actually the javascript method wouldn't have done anything about the xml files being cached it would just catch the container so your solution is better anyway since the xml is likely a lot smaller and probably changes more frequently than the flash shell.

but for future reference using something like the swf object the code would be
Code: [ Select ]
<script type="text/javascript">
        // <![CDATA[
                var fileTarg = "myflash.swf?id="+Math.floor(Math.random()*5000);
        var so3 = new SWFObject(fileTarg, "flashName", "900", "290", "8");
        so3.addParam("wmode", "transparent");
        so3.addParam("scale", "noscale");
       
        // ]]>
        </script>
 
  1. <script type="text/javascript">
  2.         // <![CDATA[
  3.                 var fileTarg = "myflash.swf?id="+Math.floor(Math.random()*5000);
  4.         var so3 = new SWFObject(fileTarg, "flashName", "900", "290", "8");
  5.         so3.addParam("wmode", "transparent");
  6.         so3.addParam("scale", "noscale");
  7.        
  8.         // ]]>
  9.         </script>
  10.  
Basically just rewriting the url at runtime.
  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

Thanks again graphixboy, I been playing with amfphp to deal with php and databases, which is how im use to working with websites so maybe that will provide a better solution. I'm liking what I see from it so far.

As far as the javascript you just basically put that in the html file that olds the flash? and do i need to take out the code that flash publishes out or does it not matter to have both on?

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 12 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.