Display objects composited into a bitmap : Bitmap : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » Bitmap »

 

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(100100, false, 0xFFFFFFFF);
        
        canvas.draw(rect);
        
        var matrix:Matrix = new Matrix(  );
        matrix.translate(1010);
        canvas.draw(ellipse, matrix);
        
        var bmp:Bitmap = new Bitmap(canvas);
        addChild(bmp);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» Bitmap