Welcome, Guest
  • Author Topic: Images from database not refreshing  (Read 3085 times)

    fpoblete

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Images from database not refreshing
    « on: 05/28/08, 00:29 »
    Hi, I'm using PHP + MySQL + Flash (Actionscript 2.0) for having an image and text loaded into some movie clip and dynamic text.

    I use this to achieve it:
    myData3 = new LoadVars()
       myData3.ref = this
       myData3.load("test.php");
       myData3.onLoad = function(succes){
          if(succes){
             this.ref["image_holder"].loadMovie(this["image_filename"]);
                            this.ref["text_holder"].htmlText(this["text"]);
          } else trace("Error loading data")
       }


    I have a refresh problem though:
    • If I change the filename in the database and point to a new file, everything works great. Same stuff for the text: if the layer containing the AS code is refreshed, so it's the variables content, and then the dynamic text-box and movie clip holder (obviosly, if the swf is reloaded, it will work too).
    • BUT, if I change the image file itself (for example, resize or replace it), there's no update in the flash: the user still sees the same image when refreshing the layer or reopening the html/swf file. It only works if the cache is cleared (tested in firefox). Html "pragma no-cache" stuff doesn't help either. I think that when the loadMovie is reloaded, it just checks if there was any change in the variables values. If that's not the case, the "movie" (image in this case) would be the one cached in the first load.

    Am I right? Is there any way to prevent the flash from caching images (and media in general)?


    Fernando.

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Images from database not refreshing
    « Reply #1 on: 05/28/08, 01:56 »
    This only happens, when the filename is exactly the same.
    This is not a flash problem, but rather the problem of the browser.
    The browser receives the request for that image - realizes, that the exact same request was made before, and delivers the image from the cache.
    happy flashing
    8)
    Ronald

    fpoblete

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re: Images from database not refreshing
    « Reply #2 on: 05/28/08, 06:59 »
    That's what I supposed.
    One more question then: Why does a "no cache HTML's tag" work? Is it because the flash is cached while being showed, but cleared out on exit?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Images from database not refreshing
    « Reply #3 on: 05/28/08, 08:43 »
    you would need the nocache header in front of the picture.
    Or just give the picture a different name, when it is changed.
    happy flashing
    8)
    Ronald