ANE-ImagePicker is a native extension that allows you to display native UI to pick an image from the gallery or take a picture with the camera on iOS and Android. After the UI pick dialog is fired, the user can choose an image. When the user picks an image, a callback is invoked with the selected file data (a BitmapData
and a ByteArray
).
The extension has a set of advanced features, such as square cropping, custom positioning for the gallery image picker on iPad and custom overlay to avoid white screen when loosing Stage3D context.
Sample
// Take a picture with the camera if (AirImagePicker.getInstance().isCameraAvailable()) { AirImagePicker.getInstance().displayCamera(function(image:BitmapData, data:ByteArray):void { // Do something with the BitmapData or the JPEG-encoded ByteArray }); } // Pick an image from the gallery if (AirImagePicker.getInstance().isImagePickerAvailable()) { AirImagePicker.getInstance().displayImagePicker(function(image:BitmapData, data:ByteArray):void { // Do something with the BitmapData or the JPEG-encoded ByteArray }); }
RT @as3gamegears: New: ANE-ImagePicker (native extension to pick img from gallery or camera on Android and iOS) http://t.co/49YRFRG9n1 #as3…
Hi, I have tested this ANE on Flash CS6 and AIR 3.4, 3.5, 3.7, but it not work. It fails to open the gallery to select image.
When I invoke:
AirImagePicker.getInstance().displayImagePicker(function(image:BitmapData, data:ByteArray):void {
// Do something with the BitmapData or the JPEG-encoded ByteArray
});
nothing happens.
Help me, please.
Hi Alex! I had no chance to try this ANE myself. Perhaps you could ping @freshplanet and ask for some tips.
Need help too. Nothing happens but the trace “ImagePicker is Available”.
if (AirImagePicker.getInstance().isImagePickerAvailable())
{
trace(“ImagePicker is Available”);
var anchor : Rectangle = getBounds(stage);
AirImagePicker.getInstance().displayImagePicker(onImagePicked, false, true, anchor);
}
function onImagePicked(image:BitmapData, data:ByteArray):void
{
if (image)
{
trace(“[AirImagePicker Test] ANE returned image of ” + image.width + “x” + image.height);
}
if (data){
trace(“[AirImagePicker Test] ANE returned JPEG data of ” + data.length + ” bytes”);
}
}
Thx
Hi, Florian! It looks like some sort of permission problem myabe. As I advised Alex, please ping @freshplanet for more help.
can i pick more then 1 image at a time with this extension ?
I am not sure, but judging by the API, I don’t believe you can pick more than one image at the time.
Is there a way to pick more then 1 image from the cameraroll?
No doubt you are going to waste quality time with this ANE as it has some issues. here is what i did that worked for me. make sure the android part of your xml looks like this
<![CDATA[
]]>
then use this prebuilt ANE at this address.
http://robotdev.co.uk/files/AirImagePicker.zip