Skip to content

Instantly share code, notes, and snippets.

@marchbold
Created September 8, 2016 06:34
Show Gist options
  • Save marchbold/77cfcd984dd4d6df1f786f3850ee1905 to your computer and use it in GitHub Desktop.
Save marchbold/77cfcd984dd4d6df1f786f3850ee1905 to your computer and use it in GitHub Desktop.
Capture an Image using the CameraUI
CameraUI.service.addEventListener( CameraUIEvent.COMPLETE, cameraUI_completeHandler );
CameraUI.service.addEventListener( CameraUIEvent.CANCEL, cameraUI_cancelHandler );
CameraUI.service.launch( MediaType.IMAGE );
...
private function cameraUI_completeHandler( event:CameraUIEvent ):void
{
// Here you can use the event.path to access the media file as you require
// Display the captured image
var l:Loader = new Loader();
l.load( new URLRequest( event.path ));
addChild( l );
}
private function cameraUI_cancelHandler( event:CameraUIEvent ):void
{
trace( "user cancel" );
}
// com.distriqt.CameraUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment