As suggested Matrix will get you there. Here is some sample code:

var box1 = new Sprite();
box1.graphics.beginFill(0xff0000);
box1.graphics.drawRect(-10,-10,10,10);
box1.graphics.endFill();
box1.graphics.beginFill(0x00ff00);
box1.graphics.drawRect(0,0,20,20);
box1.graphics.endFill();
addChild(box1);
box1.x = 10;
box1.y = 10;


var bounds = box1.getBounds(box1);
var bmd = new BitmapData(bounds.width, bounds.height, true, 0x000000);
bmd.draw(box1, new Matrix(1,0,0,1, -bounds.x, -bounds.y),null, null,null, true);
var bm = new Bitmap(bmd);
addChild(bm);
bm.x = 100;
bm.y = 0;


note that what used to be the -10, -10 point in the original sprite has be translated to the 0,0 point in the bitmap so if you wanted to line the two up you need to compensate for this difference in registration point.

hth,

Rob


On 3-Jul-08, at 8:52 AM, Ashim D'Silva wrote:

I've found you have to set up the bitmapdata to have 4 channels
instead of 3 to get transparency.
So for a transparent image...

new BitmapData(width, height, true, 0x00000000);

That should make it truly transparent.

And for the first part, I haven't tried it, but have you looked into
using a Matrix?

2008/7/3 jonathan howe <[EMAIL PROTECTED]>:
Hi, gang,

I have a long list of MovieClips. For each one, I want to create a bitmap
icon that shows the first frame.

The problems I'm having:
1. The MovieClips often have content above and before (-y and -x) the
registration point, and simply performing BitmapData.draw() I don't seem to
get the "negative" data
2. I'd like transparency on the resultant bitmaps.

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to