Display objects composited into a bitmap
package{
import flash.display.*;
import flash.geom.*;
public class Main extends Sprite{
public function Main(){
var rect:Shape = new Shape( );
rect.graphics.beginFill(0xFF0000);
rect.graphics.drawRect(0,0,25,50);
var ellipse:Shape = new Shape( );
ellipse.graphics.beginFill(0x0000FF);
ellipse.graphics.drawEllipse(0,0,35,25);
var canvas:BitmapData = new BitmapData(100, 100, false, 0xFFFFFFFF);
canvas.draw(rect);
var matrix:Matrix = new Matrix( );
matrix.translate(10, 10);
canvas.draw(ellipse, matrix);
var bmp:Bitmap = new Bitmap(canvas);
addChild(bmp);
}
}
}
Related examples in the same category