views:

495

answers:

1

I have two functions in a actionscript class, they are:

private function loaderCompleteHandler(event:Event):void { _loader = Loader(event.target.loader); selectedBitmap = Bitmap(_loader.content); }

public function byteArrayToBitmap( byteArray:ByteArray ):void { _loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loaderCompleteHandler ); _loader.loadBytes( byteArray ); }

Is it possible to send the selectedBitmap variable back to the byteArrayToBitmap function after the event completed?

Thanks.

+1  A: 

Not clear what you want to do.

You cannot return anything from the same call stack as the original call to byteArrayToBitmap, and there's no "sleep" available in AS3. Once you get into "loadCompleteHandler", you cannot return anything to the caller of byteArrayToBitmap. So you'll have to modify the caller to wait for the event COMPLETE and then check for the selectBitmap object. This will have to be stored somewhere.

That is, if I understand your problem.

Glenn
Thanks, Glenn. You understand my question. Actually, I think it is impossible, I just want to confirm it.
michael