actionscript 3 - How to send data away immediately by URLLoader in ActionScript3? -


grateful reading first.

this code:

private function send( pkt:bytearray ) {      var int count = 0;      var request:urlrequest = new urlrequest( ... );      var loader:urlloader = new urlloader( ... );       request.contenttype = urlloaderdataformat.binary;      request.method = urlrequestmethod.post;      loader.addeventlistener(event.complete, loader_complete);      loader.dataformat = urlloaderdataformat.binary;       request.data = pkt;      loader.load( request );       //to pause execution      while( count < 100000000 ); } 

the complete event not dispatched before last while loop ended. that's after urlloader.load( urlrequest ), loader not sent data away immediately( no delay )? cause number of loader.load(request) commands need executed continuely , in order, need send data away without delay each load command in order. how solve it?

thanks.

if understood correctly, looking this:

private function loader_complete(e:event):void{     if(this._ba.bytesavailable > 0){         this.send();     } }  private function send():void{        var sendba:bytearray = new bytearray();        this._ba.readbytes(sendba, 0, math.min(1024, this._ba.bytesavailable));        var request:urlrequest = new urlrequest("...");        request.contenttype = urlloaderdataformat.binary;        request.method = urlrequestmethod.post;        request.data = sendba;        var loader:urlloader = new urlloader(request);        loader.addeventlistener(event.complete, loader_complete);        loader.dataformat = urlloaderdataformat.binary; } 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -