Print a bitmap without printing a sprite?
- by Carlos Barbosa
Following up from: http://stackoverflow.com/questions/3021557/as3-printing-problem-blanks-swf-after-print-or-cancel
I am trying to comeup with a function to print without creating a sprite, because that's what it seems to be causing my problem:
public function printScreen():void {
var pJob:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
var bitmapData:BitmapData = new BitmapData(root.width, root.height);
bitmapData.draw(root);
var printThis:Bitmap = new Bitmap(bitmapData);
try {
pJob.start();
pJob.addPage(printThis, null, options);
pJob.send();
}
catch(e:Error)
{
trace("Error Printing")
}
}
This is coming up with an:
Error: Description Implicit coercion of a value of type flash.display:Bitmap to an unrelated type flash.display:Sprite.
So how do you print a bitmap without creating a Sprite?