I am wondering if someone can tell me how to force a wait till an asynchronous process finishes.
Following is the code that I'm having trouble with:
private function stage_1_processing(): void
{
var inStream:FileStream = new FileStream();
inStream.open(filein, FileMode.READ);
var ba:ByteArray = new ByteArray();
inStream.readBytes(ba);
inStream.close();
//Transform byteArray to bitmapdata
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, stage_2_processing);
loader.loadBytes(ba); // this is an asynchronous operation!!
}
private function stage_2_processi