This may go under the php section, but I put it here because it may have more to do with AS.
I currently have a flash file and a php file. The flash file sends a byte array to the php file and the php file creates a .jpeg from it.
I’m now looking for a way for the php file to tell the flash file that it’s done creating the .jpeg so the flash file can do something else.
Here’s my AS3 code:
var jpgSource:BitmapData = new BitmapData (canvas.width, canvas.height);
jpgSource.draw(canvas);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
var request:URLRequest = new URLRequest ( "saveImage.php" );
var loader: URLLoader = new URLLoader();
request.contentType = "application/octet-stream";
request.method = URLRequestMethod.POST;
request.data = jpgStream;
loader.load( request );
And here’s my php code:
<?php
$fp = fopen('image.jpeg', 'wb');
fwrite($fp, $GLOBALS['HTTP_RAW_POST_DATA']);
fclose($fp);
?>
Now I’m looking for a way for the php file to send some data to the flash file telling it it’s done writing the .jpeg. A listener maybe?
Thanks!