title: Flash: BitmapData.draw(Video) ignores video height
body: <p>I'm pretty much the rookiest rookie when it comes to Flash.</p>
  
  <p>Here's the actionscript (3):</p>
  
  <pre><code>// Here's the dumb-dumb:
  /*****************************************************************/
  /*****************************************************************/
  function captureImage(e:MouseEvent):void {
      // The video still-image is captured and drawn...but at 320x240? Oh, and the real kicker is that it gets squeezed (resized), not cropped.
      bitmapData.draw(video);
  }
  /*****************************************************************/
  /*****************************************************************/
  
  
  // Here's the other relevant code...
  /*****************************************************************/
  var bandwidth:int = 0;
  var quality:int = 100; 
  
  var myWidth:int = 320; // the width for camera, video, and bitmaps.
  var myHeight:int = 320; // the height for camera, video, and bitmaps.
  
  var cam:Camera = Camera.getCamera();
  cam.setQuality(bandwidth, quality);
  cam.setMode(myWidth,myHeight,30,false); // (width, height, FPS, favorSize)
  
  var video:Video = new Video();
      video.attachCamera(cam);
      video.x = 20;
      video.y = 20;
      // setting the video.width and video.height here makes the video appear in the desired aspect-ratio (1:1). If this is not set it defaults to 320x240.
      video.width = myWidth;
      video.height = myHeight;
  addChild(video);
  
  // 0xff0000 sets a red background just so I can see that the BitmapData "element" is 320x320 like it should be.
  var bitmapData:BitmapData = new BitmapData(myWidth, myHeight, false, 0xff0000);
  
  var bitmap:Bitmap = new Bitmap(bitmapData);
      bitmap.x = 360;
      bitmap.y = 20;
      bitmap.width=myWidth;
      bitmap.height=myHeight;
  addChild(bitmap);
  
  
  // capture_mc is my take-a-picture button. :-)
  capture_mc.buttonMode = true;
  capture_mc.addEventListener(MouseEvent.CLICK,captureImage);
  </code></pre>
  
  <p>So, what am I missing here. I know the makers of Flash don't insist that all images should be displayed in a 4:3 aspect ratio, right? :o)</p>
  
  <p>Anyway, thanks for helping out a "n00b".</p>
  
  <p>p.s. The fact that Flash uses Ctrl+Y to "redo" instead of Ctrl+Shift+Z (like Photoshop) makes me want to <code>flash.events.destroy(flash)</code>, or something.</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>I figured out how to stretch the video from 240 to 320. But there is a significant reduction in quality in doing that. Here is the code with the updated parts in <strong>BOLD</strong>:</p>
  
  <p><code>var bitmapData:BitmapData = new BitmapData(myWidth,</code><strong><code>240</code></strong><code>, false, 0xff0000);</code><br>
  <code></code><br>
  <code>var bitmap:Bitmap = new Bitmap(bitmapData);</code><br>
  <code>bitmap.x = 360;</code><br>
  <code>bitmap.y = 20;</code><br>
  <code>bitmap.width=myWidth;</code><br>
  <strong><code>bitmap.height=240;</code></strong><br>
  <strong><code>bitmap.scaleY=1.333; // ADDED scaleY</code></strong><br>
  <code>addChild(bitmap);</code>  </p>
  
  <p>So I'd still like to find a solution that maximizes the quality.</p>