Skip to content

saumya/AnCam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnCam

An OpenFL Android extension to use Camera.

For the basics of an Android extension, have a look at RayToast

Available Methods

  • initCamera()Void : just a test
  • startCamera():Void : fires up camera and takes picture
  • captureImageAs(imgName:String):Void : Mostly needed this one. It takes the image name as a parameter and saves it

Usage

  • Two steps
  1. Call it like AnCam.captureImageAs("myPhoto");
  2. Listen to the event as AnCam.dispatcher.addEventListener(AnCam.CAM_CAPTURED_EVENT,onCamCaptured);
   // add the event listener
   AnCam.dispatcher.addEventListener(AnCam.CAM_CAPTURED_EVENT,onCamCaptured);
   // capture the image and save it
   AnCam.captureImageAs("myPhoto");// it will be saved as myPhoto.jpg
   // load it in the application
   private function onCamCaptured(e:Event):Void{
   	var sCamImage:String = System.userDirectory + 'myPhoto' +'.jpg';
   	var r:URLRequest = new URLRequest(sCamImage);
   	var loaderImage:Loader = new Loader();
   	loaderImage.load(r);
   	addchild(loaderImage);
   }

Notes

  • The JNI short code reference
  • change build.gradle located at dependencies/android/build.gradle to have classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
    • it looks as
    dependencies {
     	classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
     }
    

About

An OpenFL Android Extension to use Camera

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published