Skip navigation
havefreetime
Currently Being Moderated

[Flex Mobile] take photo without lauching Camera application.

Oct 10, 2013 9:37 PM

Hi there.

Is it possible to take photo without lauching Camera app?

Following source code must select PhotoApp when I click the button.  I wanna take a photo only using my app.

I've searched enough in Google. Please give me a hint.

Thanks in advanced.

Kevin.

<?xml version="1.0" encoding="utf-8"?>

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

           xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"

           creationComplete="view1_creationCompleteHandler(event)">

     <fx:Script>

           <![CDATA[

                import mx.events.FlexEvent;

               

                private var camera:CameraUI;

                private var file:File;

               

               

                protected function view1_creationCompleteHandler(event:FlexEvent):void

        {

                     // TODO Auto-generated method stub

                     if(CameraUI.isSupported)

          {

                           camera = new CameraUI();

                           camera.addEventListener(MediaEvent.COMPLETE, onComplete);

                           camera.addEventListener(ErrorEvent.ERROR, onError);

          }

        }

               

                private function onError(event:ErrorEvent):void

        {

                     trace("Error");

        }

               

                private function onComplete(event:MediaEvent):void

        {

                     var mediaPromise:MediaPromise = event.data;        

        }

               

                private function captureImg(event:MouseEvent):void

        {

          camera.launch(MediaType.IMAGE);

        }

               

               

               

           ]]>

     </fx:Script>

    

     <s:Panel title="TakePhoto" width="90%" height="90%" top="5">

           <s:Button label="TakePhoto" click="captureImg()" />

     </s:Panel>

</s:View>

 

 
Replies
  • Currently Being Moderated
    Oct 11, 2013 8:02 PM   in reply to havefreetime

    If you can have a video stream playing in your app, you should be able to select one of the frames of the video stream and save it as a jpg. I think it will be a bitmap object. This way you do not actually invoke the system camera.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points