Printjob's addPage method期待Sprite作爲第一個參數。
你想通過傳遞0來達到目的?
如果你想有一個空白頁,請嘗試:
var myPrintJob:PrintJob = new PrintJob();
myPrintJob.start(); /*Initiates the printing process for the operating system, calling the print dialog box for the user, and populates the read-only properties of the print job.*/
myPrintJob.addPage(new Sprite());
myPrintJob.send();
有一個紅色的方形又如:
var s:Sprite = new Sprite();
s.graphics.beginFill(0xFF0000);
s.graphics.drawRect(0, 0, 80, 80);
s.graphics.endFill();
var myPrintJob:PrintJob = new PrintJob();
myPrintJob.start(); /*Initiates the printing process for the operating system, calling the print dialog box for the user, and populates the read-only properties of the print job.*/
myPrintJob.addPage(s);
myPrintJob.send();
更多信息here。
要打印階段的一部分,你可以:
1)總結要在精靈打印和精靈通過對addPage(一切)。
或
2)使用的BitmapData
var bd :BitmapData = new BitmapData(stage.width, stage.height, false);
bd.draw(stage);
var b:Bitmap = new Bitmap (bd);
var s:Sprite = new Sprite();
s.addChild(b);
var printArea = new Rectangle(0, 0, 200, 200); // The area you want to crop
myPrintJob.addPage(s, printArea);
這不是您的問題。如何聲明'btn'? – Dave