簡體   English   中英

在 AS3 (Flash CS3) 中打印影片剪輯

[英]Printing Movieclip in AS3 (Flash CS3)

我知道這個論壇上有類似的問題,但我已經嘗試過發布的想法,但沒有奏效。

基本上,我們正在嘗試打印一個包含用戶繪制的圖形的影片剪輯。 我們有一個矩形作為 canvas,有些圖形可能在這個 canvas 之外。 我們要做的是打印 canvas 中的內容,它不是從 (0,0) 開始的。 canvas 還需要在打印前調整大小以正確適合紙張。

我們想知道是否有人對此有解決方案? 我們嘗試了很多不同的東西,但總是被剪掉或尺寸錯誤,甚至拉伸不當。

這是我們超級混亂的代碼!

    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;
}

使用allGraphic.width會出現問題。 這是繪圖區域的完整寬度,包括負片和正片重疊。 您還應該使用scaleXscaleY而不是設置縮放的寬度和高度(返回只是對scaleX = scaleY = 1的調用)。

我建議使用 canvas 的固定尺寸,用戶可以在其中繪制用於您的比例計算。 您也可以使用 canvas 大小的mask來“剪切”重疊的圖紙。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM