2 Replies Latest reply on Feb 2, 2012 9:53 AM by dmeN

    iOS - camera?

    dmeN Level 5

      Is it possible to get to the camera on iPad or other iOS device?

      We're looking at doing an augmented reality thing for iPad using Flash and the FLAR toolkit... just wondering if it's even possible at all.

       

      If it's not possible does anyone have any suggestions?

        • 1. Re: iOS - camera?
          markc888 Level 2

          It certainly is. Somthing like this (untested)

           

          import flash.display.*;

          import flash.events.*;

          import flash.media.*;

          import flash.events.MediaEvent;

           

          var loader:Loader;

           

          var cam:CameraUI;

          cam = new CameraUI();

           

          cam.addEventListener(MediaEvent.COMPLETE, photoTakenComplete, false, 0, true);

          cam.launch(MediaType.IMAGE);

           

           

          private function photoTakenComplete(event:MediaEvent):void {

           

          cam.removeEventListener(MediaEvent.COMPLETE, photoTakenComplete);

           

          var mediaPromise:MediaPromise = event.data;

          if (mediaPromise.file == null) {

           

                    loader = null;

                    loader = new Loader();

                    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageloader_complete, false, 0, true);

                    loader.loadFilePromise(mediaPromise);

                    return;

                    }

          }

           

           

           

          private function imageloader_complete(e:Event):void {

           

          loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, imageloader_complete);

           

          imageBitmap = e.target.content;

                    

          if(imageBitmap != null){

             imageBitmap.smoothing = true;

          }

           

           

          addChild(imageBitmap);

           

          }

          • 2. Re: iOS - camera?
            dmeN Level 5

            Thanks much!