title: Does clipRect parameter of the BitmapData.draw method really clips the source?
body: <p>The <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#draw%28%29" rel="nofollow noreferrer">documentation</a> says that clipRect parameter of the BitmapData.draw method sets clipping for the source. Reading this I wrote an AnimatedObject class for my potential flash game. This class draws a frame from a .png animation strip, and doesn't work with Flash scene hierarchy.</p>
  
  <pre><code>var frame : Number;
  
  public function onDraw(backBuffer : BitmapData) : void
  {
          var frameClipRect : Rectangle = new Rectangle(int(frame) * celWidth, 0, frameWidth, frameHeight); // set a clip rect to pick a particular frame
  
          var matrix : Matrix = new Matrix();
          matrix.translate(-frameWidth / 2, -frameHeight / 2);
          if ( scale )
                  matrix.scale(scale, scale);
          if ( angle )
                  matrix.rotate(Math.PI * angle / 180.0);
          matrix.translate(frameWidth / 2, frameHeight / 2);
          matrix.translate(x, y);
  
          backBuffer.draw(bitmap, matrix, null, null, frameClipRect, true);
  }
  </code></pre>
  
  <p>I expected that this would work, but there is a problem with clipping. This code actually show nothing. I played a bit and figured out that <b>clipRect actually sets clipping for target bitmap, not for source.</b> Which is very strange and doesn't match with the documentation.</p>
  
  <p>What do you think? Does clipRect parameter of the BitmapData.draw method really clips the <b>source</b>? Is there a problem in my code?</p>
  
  <p>Thank you!</p>
  
  <p>Note: if you just omit frameClipRect parameter, then you sprites correctly transformed but showing every frame.</p>