Skip to main content
Participating Frequently
November 18, 2011
Question

FREBitmapData.acquire() occure error..#3503

  • November 18, 2011
  • 1 reply
  • 2323 views

Hello..

I want to send image from flash to native extension..

so i call acquire() for FREBitmapData in native extension code..

but The Code is occuring the error below...

Error: Error #3503: The extension was left in an invalid state.

Why does this error occur?..

The source code is below..

[FLASH CODE]

protected function onMouseDownHandler(event:MouseEvent):void

{

          var bitmap:Bitmap = new IMAGE_FACE() as Bitmap;

          faceDetector.findFace(bitmap.bitmapData);

}

[NATIVE CODE in Extension]

public FREObject call(FREContext freContext, FREObject[] arguments)

{

          Log.i("air.extension", "[FaceDetector2.findFace()]");

          try

          {

                    FREBitmapData freBitmapData = (FREBitmapData) arguments[0];

                    freBitmapData.acquire();  <==  ERROR : Error: Error #3503: The extension was left in an invalid state.

                    Log.i("air.extension", faceInfo.toString());

                    int width = freBitmapData.getWidth();

                    int height = freBitmapData.getHeight();

                    ByteBuffer byteBuffer = freBitmapData.getBits();

  int[] buffer = byteBuffer.asIntBuffer().array();

  faceInfo.nbFace = FaceEngine.FindFace(buffer, width, height, faceInfo);

          }

          catch (IllegalStateException e)

          {

                    // TODO Auto-generated catch block

                    e.printStackTrace();

          }

          catch (FREInvalidObjectException e)

          {

                    // TODO Auto-generated catch block

                    e.printStackTrace();

          }

          catch (FREWrongThreadException e)

          {

                    // TODO Auto-generated catch block

                    e.printStackTrace();

          }

          finally

          {

            }

          return null;

}

This topic has been closed for replies.

1 reply

Participant
November 19, 2011

Please read the API at http://help.adobe.com/en_US/air/extensions/WS11d1def534ea1be0-67da1176132a8869db6-7ffe.html

You after you call acquire(), you can only call getBits(), not getWidth() or getHeight().  And, you must call release() when you are done with the bits, or you will certainly get Error #3503.