Skip to main content
Participating Frequently
February 7, 2012
Question

Overlaying the CameraUI component with a png?

  • February 7, 2012
  • 1 reply
  • 2154 views

Hi there,

In a similar vein to the 100's of 'booth' type apps on the AppStore, I am trying to overlay the CameraUI component with a template (png), enabling our users to line up their face correctly.  As far as I understand it, the CameraUI isn't actually on the displaylist for me to overlay...

Before I look into this any further, could some one with more Air experience save me the hassle and tell me whether it's actually possible?

Any insight would be amazing.

Cheers!

This topic has been closed for replies.

1 reply

MeThYAuthor
Participating Frequently
February 7, 2012

On further research, it appears you need access to CameraOverlayView (native) - as explained here: http://stackoverflow.com/questions/1001347/iphone-camera-preview-overlay

MeThYAuthor
Participating Frequently
February 8, 2012

To answer my own question.

The only way you overlay the camera image is if you avoid the CameraUI class and capture the camera image in the traditional way (see below).

private function findCamera():void

{

  if (!Camera.isSupported)

  {

    return;

  }

       var cam:Camera = this.getCamera(CameraPosition.BACK);

       cam.setMode(960, 480, 30);

       var video:Video = new Video(960, 480);

       video.attachCamera(cam);

       addChild(this.video);

  }

  // Get the requested camera. If it cannot be found,

  // return the device's default camera instead.

private function getCamera(position:String):Camera

  {

       for (var i:uint = 0; i < Camera.names.length; ++i)

       {

            var cam:Camera = Camera.getCamera(String(i));

            if (cam.position == position) return cam;

       }

     return Camera.getCamera();

  }

Known Participant
October 21, 2013

Any news on this? I´m working on an app where I need to create custom camera controls/buttons using the CameraUI.