You're right, it's a bit tricky or at least, it doesn't work in the most
intuitive way.

To get what you want, you have to use both a Matrix and a Rectangle.

Leave the rectangle x and y in 0 and set the width and height to match the
size of the cropped image. Then use the matrix.translate() with the x and y
you want, but inverted. It's like before copying the data, you were first
moving the original sprite to make it's 0,0 point match the point you want
to start copying from.

Something like this:

var bmd:BitmapData = new BitmapData(90,20);
var mat:Matrix = new Matrix();
mat.translate(-10,-5);
var rect:Rectangle = new Rectangle(0,0,90,20);
bmd.draw(src_mc,mat,null,null,rect);


Cheers
Juan Pablo Califano


2008/11/12, John Giotta <[EMAIL PROTECTED]>:
>
> I've tried:
> bmd.draw(o_art, null, null, null, new Rectangle(10, 5, 90, 20));
>
> Which I assumed would set my selection 10 pixels left, 5 pixels down,
> 90x20, but instead I get a rectangle of the right shape, but 10 pixels
> to the left and 5 of the top is white.
>
> - John G
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to