A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: how to avoid my flash loading from cache

  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    61
    Hai flash experts.

    If we see some flash file in IE, it will save in cache. While opening the same its loadin from cache. How to avoid this. I need to load movie from my server. Because i'm updating my external text file throughout day. If i opened IE and keep refreshing the new updated messages is not displaying. flash movie its loading from temporary interfiles. So i'm not able to view my updated text file message. What to do.

    Pls anyone have solution for this. kindly help me

    thx
    sathish

  2. #2
    Senior Member Wancieho's Avatar
    Join Date
    May 2002
    Posts
    370
    In your internet explorer click:
    Tools-->
    Internet options-->
    Settings(under temporary internet files)-->
    (click)•Every visit to the page.

    Unfortunately this is the only solution that I know of.

  3. #3
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    you could read the text file through a server script that tells the browser not to cache the data

    Musicman

  4. #4
    Member
    Join Date
    Jul 2002
    Posts
    61

    hai

    Hai Musicman
    I'm able to read the text file messages in flash movie, but the updated one. If opened new browser i'm able to see the new messages. I need to see the updated messages in existing IE browser itself. IF i refresh the browser also its loading from cache.

    Hai Wancieho, that is a poor solution

    what i've to do. Pls give solution. i need to fix quick.

    thx
    sathish

  5. #5
    Senior Member Wancieho's Avatar
    Join Date
    May 2002
    Posts
    370
    Well, if it's just for you to see the update I don't see a problem? With a couple of clicks you can change it back to the original settings when u go online.

    Older versions of IE didn't even cache properly and it re-downloaded the page in any case. This works on the same principal.

    Otherwise go here:
    http://support.microsoft.com/default.aspx?pr=kbinfo and search for caching. I went there once to check out the same thing as you. There's something that you can embed into a html file but I don't know if it'll work for text files. I just landed up "disabling" the cache with my settings It was a whole lot easier.

    Besides there's nothing u can do about a service provider caching on their server!

  6. #6
    Member
    Join Date
    Jul 2002
    Posts
    61

    still ididn't get any solution

    Hai

    Can u have any solution. Kindly give me any other solution

    thx
    sathish

  7. #7
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    the server idea as a php script (you can do the same thing with cgi, asp, coldfousion...)

    Replace loadvariables('info.txt', ...) by loadvariables('info.php', ...)
    with info.php script
    <?
    header('Cache-control: no-cache');
    header('Pragma: no-cache');
    header('Expires: Jan 01 2000 00:00 GMT');
    $fp = fopen('info.txt', 'r');
    fpassthru($fp);
    ?>
    In case you want to do the same for the swf file, you should add a
    header('Content-type: application/x-shockwave-flash');

    Musicman

  8. #8
    Junior Member
    Join Date
    Jan 2010
    Posts
    2

    Clarification request.

    Quote Originally Posted by Musicman View Post
    Hi,

    ...

    In case you want to do the same for the swf file, you should add a
    header('Content-type: application/x-shockwave-flash');

    Musicman

    Hello,

    I'm working on an older site that used to be populated by an ASP-based database. Long story short the database is gone and I've been added to the team to make regular, hard-coded changes to the SWFs.

    The client and I know this isn't ideal, but it's how things are going to be. It's running smoothly except for caching. The main index SWF loads other SWFs via loadMovie() (and not via a loadvariables or txt/php file) and unless a user has it set up so that their cache is cleared periodically it's impossible for them to get updates.

    The above quote seems like a potential solution but am unfamiliar with it and don't know how to alter it to my needs. To me it just looks like a header that identifies what's on the page, not a header that would help keep SWFs from being cached.

    Any ideas or clarifications out there?

    Thanks!

    -j

  9. #9
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    when delivering swf from a server script, you habe both headers to tell it is swf and headers to tell it is non-cache
    BTW: beware of swf embedding schemes that automatically add the .swf extension - you may need to edit the embedding javascript to accept .php instead
    Also, if this is going to run on a windows server, be sure to use "binary" mode.
    Here is a complete script that could be called movie1.php
    Code:
    <?
    header('Cache-control: no-cache');
    header('Pragma: no-cache');
    header('Expires: Jan 01 2000 00:00 GMT');
    header('Content-type: application/x-shockwave-flash');
    $fp = fopen('movie1.swf', 'rb');
    fpassthru($fp);
    Musicman

  10. #10
    Junior Member
    Join Date
    Jan 2010
    Posts
    2
    Quote Originally Posted by Musicman View Post
    Hi,

    when delivering swf from a server script, you habe both headers to tell it is swf and headers to tell it is non-cache
    BTW: beware of swf embedding schemes that automatically add the .swf extension - you may need to edit the embedding javascript to accept .php instead
    Also, if this is going to run on a windows server, be sure to use "binary" mode.
    Here is a complete script that could be called movie1.php
    Code:
    <?
    header('Cache-control: no-cache');
    header('Pragma: no-cache');
    header('Expires: Jan 01 2000 00:00 GMT');
    header('Content-type: application/x-shockwave-flash');
    $fp = fopen('movie1.swf', 'rb');
    fpassthru($fp);
    Musicman
    Thanks for the quick response Musicman! I appreciate it.

    I assumed that I could add your code to the beginning of the index.php but that loaded only the SWF file... which makes a lot of sense in retrospect. So I guess I should ask what point at which music1.php would come into play?

    Assuming I have the following files:
    index.php
    index.swf (embedded into the above file)
    swf2.swf
    swf3.swf

    Where the index.swf loads swf2.swf and swf3.swf via loadMovie() into a blank MC.

    It's old school.

    Ideally I'd like all three SWF files to not be cached, but can find other workarounds if I can at least get the index.swf set up to not be cached. Where would I put your code to get that done?

    Thanks again!

  11. #11
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    you would change your index.php to embed something like main.php instead of index.swf, and that would be the short script. The script in turn would reference the index.swf (or, to avoid confusion, you would rename the index.swf to main.swf)

    Musicman
    Last edited by Musicman; 01-12-2010 at 01:36 AM.

  12. #12
    </hate> dtone314's Avatar
    Join Date
    Jun 2005
    Location
    CA
    Posts
    262
    Use the 'Expires' header. The Expires header of an HTML document tells a Web browser when a cached document should expire from the cache. Using a date in the past ensures the document will always be expired.

    Insert the text below between the <HEAD></HEAD> tags of the HTML document containing the embedded SWF.
    Code:
    <!-- BEGIN INSERT --><META HTTP-EQUIV="Expires" CONTENT="Mon, 04 Dec 1999 21:29:02 GMT"><!-- END INSERT -->
    -dtøne-
    Flash CS4 | AS2
    Life is a journey, not a destination.

  13. #13
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    you will be telling the browser that your html document should not load from cache - this does not affect the elements of the html, such as swf or images

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center