BitmapData Brush

Actionscript:
  1. var canvas:BitmapData=new BitmapData(400,400,true,0xFFCCCCCC);
  2. addChild(new Bitmap(canvas));
  3.  
  4. var redOval:Shape = new Shape();
  5. with(redOval.graphics) lineStyle(0,0), beginFill(0xFF0000), drawEllipse(0,0,10,50);
  6.  
  7. addEventListener(Event.ENTER_FRAME, onLoop);
  8. function onLoop(evt:Event):void {
  9.  
  10.     redOval.x = mouseX;
  11.     redOval.y = mouseY;
  12.     redOval.rotation += 10
  13.     // transform.matrix contains all transformation information for
  14.     // the redOval including scaleX, scaleY, x, y, rotation etc...
  15.     canvas.draw(redOval, redOval.transform.matrix);
  16. }

A very easy way to create a BitmapData brush.

This entry was posted in BitmapData and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*