The Android operating system has a central repository for storing photographs captured by the variety of camera applications a user may have installed. There are APIs within AIR for Android, which allows a Flash developer to specifically target and pull from this repository for display within an application.
We must use the mobile CameraRoll
API to browse directly to the device camera roll and select a photograph for display:
1. First, import the following classes into your project:
import flash.display.Loader; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.MediaEvent; import flash.events.TouchEvent; import flash.filesystem.File; import flash.media.CameraRoll; import flash.media.MediaPromise; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode;
2. Declare a
CameraRoll
object and aLoader
, which will be used to display the...