6 Replies Latest reply on Apr 7, 2010 1:44 AM by snielsen.itu

    webcam not working with adobe air

    new flex guy Level 1

      hey frnds,

      i'm trying to capture webcam snaps and storing it on local desktop.

      Below code of capuring snap is working with flex but same code not working in adobe air.

      I'm using Adobe Flash builder beta 2

      is any setting is required to use webcam with adobe air?


      i'm using following code

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:mx="library://ns.adobe.com/flex/halo" creationComplete="init();">
              <!-- Place non-visual elements (e.g., services, value objects) here -->
                  import mx.controls.Alert;
                  import mx.core.UIComponent;
                  import flash.media.Camera;
                  import flash.media.Video;
                  private function videoDisplay_creationComplete() : void
                      var camera:Camera = Camera.getCamera();
                      if (camera)
                          Alert.show("Oops, we can't find your camera.");
                  private function capture_click() : void
                      var snap:BitmapData = new BitmapData(320, 240, true);
                      var snapBmp:Bitmap = new Bitmap(snap);
                      snapBmp.width = 320;
                      snapBmp.height = 240;
                      if(snapshotHolder.numChildren > 0)
              <s:Panel title="Video">
                  <mx:VideoDisplay id="videoDisplay" creationComplete="videoDisplay_creationComplete();" width="320" height="240" />       
              <s:Panel title="Snapshot">
                  <mx:UIComponent id="snapshotHolder" width="320" height="240" />
              <mx:Button label="reload camera" click="videoDisplay_creationComplete();"/>
              <mx:Button label="capture" click="capture_click();"/>  



      Camera is connected but cannot see anything inair,

      plz guide me in this.

      thx in advanced,