Frage

I have a Flash program that needs to make url requests to send data to the server at various times. I want Flash to keep trying the request until it is successful. How do I make sure Flash keeps trying the request and doesn't time out and quit trying to send? My code looks like this:

urlRequest = new URLRequest("https://xyz.php");
var variables:URLVariables = new URLVariables();
urlRequest.method = URLRequestMethod.POST;
variables.session_id = sessionId;
... 

urlRequest.data = variables;
urlLoader = new URLLoader(urlRequest);
urlLoader.dataFormat  = URLLoaderDataFormat.VARIABLES;
War es hilfreich?

Lösung

You can add a listener to IOErrorEvent.IO_ERROR and try again if it fails. There are other errors possible, like security errors that you could also listen for, though the chance of those failing once and then magically succeeding in the future is far less likely.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top