オープンソースの精神に感謝します! あなたの素晴らしい仕事に基づいて、私はそれを実装し、実用的な MovieClip 印刷の問題を解決するために少し改善します。私が達成した主な進歩は、1 回の印刷ジョブの送信のみで複数フレームのムービークリップを印刷する方法を考え出したことです。もちろん、「ムービークリップの全幅を印刷する」という問題は解決しました。SWF はベクトルグラフの形式でコンテンツを保存するため、必ずclip.height = printArea.height; clip.width = printArea.width;
. それは簡単な方法です:
1//MC printing Function
2private function printMovieClip(clip:MovieClip):void
3{
4 var printJob:PrintJob=new PrintJob();
5 var printArea:Rectangle;
6 if (!printJob.start())
7 return;
8 //The page you choose to print ,"selectPages" is a mx:combox object i used to support printing one frame of MC
9 var printPage:int=selectPages.selectedItem.data;
10 if (printPage == 0) //print all frames of the MovieClip
11 {
12 for (var i:int=1; i <= clip.totalFrames; i++)
13 {
14 clip.gotoAndStop(i);
15 /* Resize movie clip to fit within page width */
16 clip.width=printJob.pageWidth;
17 clip.scaleY=clip.scaleX;
18 /* Store reference to print area in a new variable! Will save on scaling */
19 printArea=new Rectangle(0, 0, printJob.pageWidth, printJob.pageHeight);
20 //numPages=Math.ceil(clip.height / printJob.pageHeight);
21 /* Add pages to print job */
22 printJob.addPage(clip, printArea);
23 }
24 }
25 else //print the selected frame
26 {
//goto the selected frame firstly
27 clip.gotoAndStop(printPage);
28 /* Resize movie clip to fit within page width */
29 clip.width=printJob.pageWidth;
30 clip.scaleY=clip.scaleX;
31 printArea=new Rectangle(0, 0, printJob.pageWidth, printJob.pageHeight);
32 /* Add pages to print job */
33 printJob.addPage(clip, printArea);
34 }
35
36 /* Send print job to printer */
37 printJob.send();
38 /* Delete job from memory */
39 printJob=null;
40
41 }
さらに詳しい情報が必要な場合は、私のクリップ イメージをご覧ください (中国語が少し理解できる場合)。すべては私のブログにあります。MovieClip のサムネイルもあります(中国語のままです)。