0 Replies Latest reply on Aug 24, 2010 4:07 AM by JamesAnelay

    Why Is My Snapshot Smaller Than The Webcam?

    JamesAnelay

      I am trying to make a snapshot of the users webcam, but the snapshot is 1/4 the size of the running webcam and doesn't fill the bitmap data section. Also is there a better way I can Add and position the snapshot.?

       

      import flash.display.BitmapData;
      import flash.display.DisplayObject;
      var bandwidth:int = 0; // Specifies the maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second. To specify that Flash Player video can use as much bandwidth as needed to maintain the value of quality , pass 0 for bandwidth . The default value is 16384.
      var quality:int = 100; // this value is 0-100 with 1 being the lowest quality. Pass 0 if you want the quality to vary to keep better framerates
      var cam:Camera = Camera.getCamera();
      cam.setQuality(bandwidth, quality);
      cam.setMode(320,240,30,false); // setMode(videoWidth, videoHeight, video fps, favor area)
      video_vobj.attachCamera(cam);
      stage.addEventListener(MouseEvent.CLICK, takephoto);
      var screenS:BitmapData = new BitmapData(320, 240, true, 0xCCCCCCCC);
      var screenS_image:Bitmap=new Bitmap(screenS);
      function takephoto(e:MouseEvent):void
      {
      screenS.draw(video_vobj) ;
      addChild(screenS_image) ;
      screenS_image.x = 360;
      screenS_image.y = 20;
      }