One solution is to add a unique string to the tail of the image's URL, so the browser thinks it's a new image and goes and fetches it on every request (rather than returning it from the local cache). This fix is based on a related thread a week or two ago. The downside is that you dont get the benefit of the local cache.
 
Here's an example that illustrates it:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="doLoad()">
 
    <mx:Script><![CDATA[
    var xxx:String;
 
    public function doLoad() {
        xxx = "?CacheBuster="+Math.random();
        myImage.source = "http://www.icv2.com/images/144699Curseofwererabmd.jpg" + xxx;
    }
 
    ]]></mx:Script>
 
    <mx:ProgressBar source="myImage" />
 
    <mx:Image id="myImage" />
 
   <!-- this is just so you can see what is being generated: --> 
   <mx:Label text="{xxx}" />
 
</mx:Application>
 
HTH,
 
matt horn
flex docs
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kristopher Schultz
Sent: Tuesday, May 24, 2005 6:14 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ProgressBar and cached images problem

Hey guys and gals,
 
I've stumbled upon a quirky behavior I'm hoping you can help me resolve.
 
The ProgressBar component does not appear to work properly if the graphic asset being loaded is in the browser's cache. The simple example below illustrates this problem. The first time this app is displayed the ProgressBar properly tracks the loading of the image. But on subsequent browser refreshes, the image loads just fine but the ProgressBar remains at 0%. If the browser cache is cleared and the app is reloaded the ProgressBar once again works properly.
 
Is this a known issue? How do I work around this problem?
 
==== Example ====
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.macromedia.com/2003/mxml"
    initialize="doLoad()"
>
 
    <mx:Script>
    <![CDATA[
 
    public function doLoad()
    {
        myImage.source = "http://somedomain.com/someImage.jpg";
    }
 
    ]]>
    </mx:Script>
 
    <mx:ProgressBar source="myImage" />
 
    <mx:Image id="myImage" />
 
</mx:Application>
 
 
Kris
 
--
 
Kristopher Schultz
Developer
 
Resource Interactive
p: 614.410.2123
 


Yahoo! Groups Links

Reply via email to