Print a bitmap without printing a sprite?
Posted
by Carlos Barbosa
on Stack Overflow
See other posts from Stack Overflow
or by Carlos Barbosa
Published on 2010-06-12T07:26:11Z
Indexed on
2010/06/12
7:33 UTC
Read the original article
Hit count: 312
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?
© Stack Overflow or respective owner