ok back at another issues in as3 printing
//Function to print entire screen
function printFunction(event:MouseEvent):void
{
var myPrintJob:PrintJob = new PrintJob();
var oldScaleX:Number = root.scaleX;
var oldScaleY:Number = root.scaleY;
//Start the print job
myPrintJob.start();
//Figure out the new scale
var newScaleX:Number = myPrintJob.paperWidth/root.width;
var newScaleY:Number = myPrintJob.paperHeight/root.height;
//Shrink in both the X and Y directions by the same amount (keep the same ratio)
if(newScaleX < newScaleY)
newScaleY = newScaleX;
else
newScaleX = newScaleY;
root.scaleX = newScaleX;
root.scaleY = newScaleY;
//Print the page
myPrintJob.addPage(Sprite(root));
myPrintJob.send();
//Reset the scale to the old values
root.scaleX = oldScaleX;
root.scaleY = oldScaleY;
}
I cant seem to find anything thats really helpful with this. When i click cancel on the print dialog box, i get error below and it blanks out my swf.
The error consists, that whenever i try to print and cancel it, or even when i do succesfully print, swf goes blank.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…