AS3 draw(); only a portion of the stage

From the code here, I need to be able to set the boundaries of the bitmapData that is being drawn and saved out to a different x and y position.  When the stage is being drawn it is drawn from stage's (0,0).  I need to draw from x:55 y:46.  I have tried to use a bitmap and add the bitmapData to it but then I get a blank white box (no bitmapData).  What do I need to do?
private function saveImage (e:MouseEvent):void {
			var myBitmapData:BitmapData = new BitmapData(694,385);
			//var bitmap:Bitmap= new Bitmap(myBitmapData);
			//addChild(bitmap);
			//bitmap.x = 55;
			//bitmap.y = 46;
			//myBitmapData.draw (bitmap);
                        myBitmapData.draw (stage);
			var jpgEncoder:JPGEncoder = new JPGEncoder(80);
			var imgByteData:ByteArray = jpgEncoder.encode(myBitmapData);
			file = new FileReference();
			file.save (imgByteData, "test.jpg");
		}

Open in new window

cubical38Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Antonio EstradaEngineering Manager / ArchitectCommented:
Check the following link, it has some useful information:

http://polygeek.com/1713_flex_bitmapdatadraw-explorer

The code that you need is something like this:

<code>

Good luck

-V
var rect:Rectangle = new Rectangle( 131, 116, 220, 135 );
var colorTrans:ColorTransform = new ColorTransform( 1, 1, 1 );
_bmpData.draw( image, new Matrix(), colorTrans, normal, rect, false );

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cubical38Author Commented:
Here is the finished code:
var myBitmapData:BitmapData = new BitmapData(804,477);
                  var rect:Rectangle = new Rectangle(55,46,694,385);
                  var colorTrans:ColorTransform = new ColorTransform(1,1,1);
                  myBitmapData.draw (stage, new Matrix(), colorTrans, null, rect, false);

Thanks!
Antonio EstradaEngineering Manager / ArchitectCommented:
Glad to help!

-V
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.