actionscript 3 - Cancel a POST request -


i have app makes request server generate audio file , problem have if send 2 distinct , consecutive requests, can not cancel first. tried .unload or .unloadandstop gives me error.

any suggestions?

        elfich="sonido" + elfichnum;         var request:urlrequest = new urlrequest();         var variables:urlvariables = new urlvariables();          var loader:urlloader = new urlloader();         variables.text=caja_texto;         variables.filename=elfich;         request.url = "http://192.168.0.19:800/cgi-bin/tts.cgi";         request.method = urlrequestmethod.post;         request.data = variables;         loader = new urlloader();         loader.dataformat = urlloaderdataformat.binary;         loader.addeventlistener(event.complete, cargacompletanew);         loader.addeventlistener(ioerrorevent.io_error, onerrornew);         loader.load(request);     }      function cargacompletanew(event:event):void     {         xlocalsound = new sound();          var xreq:urlrequest = new urlrequest("http://192.168.0.19:800/output/" + elfich + ".mp3");          xlocalsound.load(xreq);         xlocalsound.addeventlistener(event.open, iniciarsonido);      } 

what about

loader.removeeventlistener(event.complete, cargacompletanew); loader.removeeventlistener(ioerrorevent.io_error, onerrornew); loader.close(); 

i think there problem close() if trying close if nothing loaded, i'd try put inn try/catch block.

try  {   loader.close(); } catch(e:error)  {   loader("oh noes!"); } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -