PDA

View Full Version : Changing the BitmapData.rectangle



four4swords
May 2nd, 2009, 04:49 AM
Hi,

I'm trying to take a 'snapshot' of a movieclip that i've got on the stage with "BitmapData" and then starting a "draw()" command on it.

I'm able to get it drawing.. however.. it only takes the things from (0,0).( the upper left corner of the movieclip.

Doing a trace on "BitmapData.rectangle" gives me it's X and Y coordinates .. and it's width and height..

How do I change the X and Y locations of the BitmapData for it to start the drawing from? As I have some stuff on the negative side of x.

Hope you guys understand!
Tell me if you need clarifying! :hugegrin:

Thanks!

four4swords
May 2nd, 2009, 09:42 PM
Ok! I found the answer in making Flash draw things even in the negative values.
If anyone wants to know.. Or stumble upon this thread years in the future.. here's how I got around it.

Via Matrix(s) - I have no idea what this is.. But it seems to work lol


import flash.display.BitmapData;
import flash.geom.Matrix;
//
var mtrix:Matrix = new Matrix();
mtrix.translate(100, 100);
This bit here will move the drawing rectangle from (0,0) to (-100,-100). Which makes the bitmap.draw() function work in the negative regions.


myBitmapData = new BitmapData(mm._width, mm._height, true, 0x00CCCCCC);
//
myBitmapData.draw(mm, mtrix);
//
_root.attachBitmap(myBitmapData, 0, "auto", true);
And that's just he rest of my code to make it chuck something onto the stage :P