Copy link to clipboard
Copied
Hi,
Grateful for your reading first.
This is my 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 the execution
while( count < 100000000 );
}
The COMPLETE event will not be dispatched before the last while loop ended.
That's to say after URLLoader.load( URLRequest ), the loader will not sent data away immediately( no delay )?
Cause a number of loader.load(request) commands need to be executed continuely and in order, I need to send data away without delay for each load command in order.
How to solve it?
Thanks.
Copy link to clipboard
Copied
while, for and do loops cannot be used to pause execution. they execute from start to finish before anything else occurs including display updates.
to remedy, use several for-loops to "chunk" your data handling.
Copy link to clipboard
Copied
Many thanks to your answer. But it has no relation to my question. I just want to POST a byteArray without delay.
Copy link to clipboard
Copied
then what's the point of your attempt to use a while-loop?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now