Re: [Flashcoders] SWF Only Loads Once

2007-04-02 Thread Andy Herrman

If I follow that code properly you're adding a 'no-cache' value to the
headers.  I'm not sure if that's the right way to do it.

Try this.  Add some query parameter to the end of your URL that has a
unique value (like the current time in milliseconds).  So something
like:

http:///path/to/file.xml?uniq=

The browsers will see that it's a different URL and will always
redownload it, but unless the server is specifically using that query
parameter it will just be ignored.

  -Andy

On 3/30/07, Daniel Thompson <[EMAIL PROTECTED]> wrote:

Thanks guys. I added a cache-busting param to the request, but it didn't fix
the issue. Here's my method:

protected function invoke(resource:String, variables:URLVariables,
successHandler:Function,
errorHandler:Function = null):void {
  variables.api_key = KEY;

  var request:URLRequest = new URLRequest();
  request.method = "GET";
  request.url = _server + FORMAT + resource;
  variables["no-cache"] = Math.round(new Date().time).toString();
  request.data = variables;

  if (errorHandler == null) {
errorHandler = onIOError;
  }

  var loader:URLLoader = new URLLoader();
  loader.dataFormat = "xml";
  loader.addEventListener(Event.COMPLETE, successHandler);
  loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);

  try {
loader.load(request);
  } catch (error:Error) {
throw new Error("Unable to connect");
  }
}



It just seems odd that if I clear my cache, everything works again.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] SWF Only Loads Once

2007-03-30 Thread Daniel Thompson
Thanks guys. I added a cache-busting param to the request, but it didn't fix
the issue. Here's my method:

protected function invoke(resource:String, variables:URLVariables, 
successHandler:Function,
errorHandler:Function = null):void {
  variables.api_key = KEY;

  var request:URLRequest = new URLRequest();
  request.method = "GET";
  request.url = _server + FORMAT + resource;
  variables["no-cache"] = Math.round(new Date().time).toString();
  request.data = variables;

  if (errorHandler == null) {
errorHandler = onIOError;
  }

  var loader:URLLoader = new URLLoader();
  loader.dataFormat = "xml";
  loader.addEventListener(Event.COMPLETE, successHandler);
  loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);

  try {
loader.load(request);
  } catch (error:Error) {
throw new Error("Unable to connect");
  }
}



It just seems odd that if I clear my cache, everything works again.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] SWF Only Loads Once

2007-03-30 Thread Adrian Lynch
I second that, only I tend to pass it in via FlashVars so I can leave it to
cache if I want to.

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Steven
Sacks | BLITZ
Sent: 30 March 2007 01:33
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] SWF Only Loads Once


XML almost always caches.  Use a noCache param.


var path:String = "some.xml";
var d:Date = new Date();
var p:String = (path.indexOf("?") > -1) ? "&noCache=" : "?noCache=";
var noCache:String = (_root._url.indexOf("http://";) > -1) ? p +
d.getTime() : "";
var xmlPath:String = path + noCache;
myXML.load(xmlPath);

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] SWF Only Loads Once

2007-03-29 Thread Steven Sacks | BLITZ
XML almost always caches.  Use a noCache param.


var path:String = "some.xml";
var d:Date = new Date();
var p:String = (path.indexOf("?") > -1) ? "&noCache=" : "?noCache=";
var noCache:String = (_root._url.indexOf("http://";) > -1) ? p +
d.getTime() : "";
var xmlPath:String = path + noCache;
myXML.load(xmlPath);


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com