BitmapData Brush

var canvas:BitmapData=new BitmapData(400,400,true,0xFFCCCCCC);
addChild(new Bitmap(canvas));

var redOval:Shape = new Shape();
with(redOval.graphics) lineStyle(0,0), beginFill(0xFF0000), drawEllipse(0,0,10,50);

addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {

	redOval.x = mouseX;
	redOval.y = mouseY;
	redOval.rotation += 10
	// transform.matrix contains all transformation information for 
	// the redOval including scaleX, scaleY, x, y, rotation etc...
	canvas.draw(redOval, redOval.transform.matrix);
}

A very easy way to create a BitmapData brush.

Leave a Reply

Your email address will not be published. Required fields are marked *