1
我知道在這個論壇上有類似的問題,但我試過發佈的想法,但他們沒有工作。在AS3中打印Movieclip(Flash CS3)
基本上我們試圖打印一個包含用戶繪製圖形的動畫片段。我們有一個用作畫布的矩形,其中一些繪圖可能在此畫布之外。我們要做的是隻打印畫布中的內容,而不是以(0,0)開始。在打印之前,畫布也需要調整大小以適合紙張。
我們想知道是否有人有解決方案嗎?我們嘗試了很多不同的東西,但事情總是被切斷或者錯誤的尺寸,甚至不適當地延伸。
這是我們的超級亂碼!
function startPrint(evnt: Event) {
printJob = new PrintJob();
var xNumber:Number = allGraphic.x; //saving the original x-value of the movieclip
var yNumber:Number = allGraphic.y; //saving y
var wNumber:Number = allGraphic.width; //saving width
var hNumber:Number = allGraphic.height; //saving height
var rect:Rectangle = new Rectangle (0,0,0,0); //printArea
var sucess = printJob.start();
if (sucess) {
if (printJob.orientation == PrintJobOrientation.LANDSCAPE) {
//allGraphic.rotation = 90;
rect.x = 115;
rect.y = 107;
rect.width = 792;
rect.height = 576;
allGraphic.width = 792;
allGraphic.height = 576;
} //end if (landscape)
else {
rect.x = 110; //x coor of the printArea rectangle
rect.y = 85; //y coor
rect.width = 875; //width of printArea
rect.height = 475; // height of printArea
allGraphic.width = allGraphic.width *(576/wNumber); //scale the movieclip width (with the drawing)
allGraphic.height = allGraphic.height * (396/hNumber); // height scaling
}//end else
printJob.addPage (allGraphic, rect);
}//end
if success
//reset allGraphic back to original size
allGraphic.x = xNumber;
allGraphic.y = yNumber;
allGraphic.width = wNumber;
allGraphic.height = hNumber;
}