Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

FileChooser is a very easy to work air native extension to let you choose a file from your device to be able to use it inside your Adobe Air project

myflashlab/fileChooser-ANE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

FileChooser ANE (Android+iOS)

FileChooser is a very easy to work with extension and lets you choose a file from your device and use it inside your AIR project. you can use the choose method and pass the type of file you need by passing its mimetype. */* for example means any file with any mimetype! but image/* means any image file while image/png means any png image file! on iOS, due to the OS limitations, no matter what input you set, it will allow you to pick images only at the moment. (in future versions, we will support picking video files on iOS too)

This extension can also optionally resize the picked image as fast as a few milliseconds for you so you don't have to load a huge image into your app!

find the latest asdoc for this ANE here.

AIR Usage

For the complete AS3 code usage, see the demo project here.

import com.myflashlab.air.extensions.fileChooser.*;

var _ex:FileChooser = new FileChooser();
_ex.addEventListener(FileChooserEvent.RESULT, onResult);
_ex.addEventListener(FileChooserEvent.ERROR, onError);

_ex.choose("*/*", "pick a file!");

function onResult(e:FileChooserEvent):void
{
	var file:File = e.param.original as File;
	trace("file.name = " + file.name);
	trace("file.extension = " + file.extension);
	trace("file.size = " + FileSizeConvertor.size(file.size));
	trace("------------------------------");
}

function onError(e:FileChooserEvent):void
{
	trace("onError = " + e.param);
}

AIR .xml manifest

<!--
FOR ANDROID:
-->
	<activity android:name="com.doitflash.fileBrowser.Chooser" android:theme="@style/Theme.Transparent" />

	
	
<!--
FOR iOS:
-->
	<key>MinimumOSVersion</key>
	<string>10.0</string>

	<key>NSPhotoLibraryUsageDescription</key>
	<string>My description about why I need this feature in my app</string>


<!--
Embedding the ANE:
-->
  <extensions>
	<extensionID>com.myflashlab.air.extensions.fileBrowser</extensionID>
	
	<extensionID>com.myflashlab.air.extensions.permissionCheck</extensionID>
	
	<!-- dependency ANEs https://github.com/myflashlab/common-dependencies-ANE -->
    <extensionID>com.myflashlab.air.extensions.dependency.overrideAir</extensionID>
    <extensionID>com.myflashlab.air.extensions.dependency.androidx.core</extensionID>
	<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.drive</extensionID>
    <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.base</extensionID>
    <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.basement</extensionID>
    <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.tasks</extensionID>
  </extensions>

Requirements

  • Android SDK 19+
  • iOS 10.0+
  • AIR SDK 30+

Permissions

Below are the list of Permissions this ANE might require. Check out the demo project available at this repository to see how we have used the PermissionCheck ANE to ask for the permissions.

Necessary Optional
SOURCE_STORAGE NONE

Commercial Version

https://www.myflashlabs.com/product/file-image-pick-ane-adobe-air-native-extension/

file picker ANE

Tech Details

  1. on the iOS side, the extension will open the native ImagePicker lib which is basically the same on all different iOS versions.

  2. You have the option to resize the images because in a real life scenario you surely don't want to load a big image like 5MB into your app, right? Although you can resize the picked image in flash and maybe with using threads (Actionscript workers) but it will be a VERY slow process. so we decided to put a native image scaler inside the choose method to scale down the selected image with keeping the aspect ratio untouched. This will make working with this extension very exceptional.

Premium Support

Premium Support package If you are an active MyFlashLabs club member, you will have access to our private and secure support ticket system for all our ANEs. Even if you are not a member, you can still receive premium help if you purchase the premium support package.

About

FileChooser is a very easy to work air native extension to let you choose a file from your device to be able to use it inside your Adobe Air project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published