我有一个打印贴纸的应用程序。使用数字步进器我可以选择必须打印多少个贴纸。每页最多可以有3个。如何制作带有贴纸的movieclip副本?如何使它们具有序列号(例如5个中的1个,5个中的2个,5个中的3个,5个中的4个,5个中的5个)?我现在有一个带有3个贴纸的预制电影剪辑,当我选择5个贴纸时,它会打印2页(6个贴纸,如果我打印8个,它打印3页等)。
function STRPRNButtonStatus(event:MouseEvent) {
var printJob:PrintJob = new PrintJob();
var pagesToPrint:uint = 0;
var ALL_STR_NUM_print = (ALL_STR_NUM.value/3);
var num1:Number = UNT_NUM.value;
var res1:Number = Math.ceil(num1/3);
var UNT_NUM_print = res1;
if (DLV_NUM_CHK.selected) {
printJob.copies = UNT_NUM_print;
}
else printJob.copies = ALL_STR_NUM_print;
var started:Boolean = printJob.start2(null, false);
if (started) {
}
try {
if (STR_CHK1.selected) {
printJob.addPage(Sticker1);
pagesToPrint++;
}
}
catch (error:Error)
{
}
if(pagesToPrint > 0) {
printJob.send();
}
else
{
printJob.terminate();
}
}
}
答案 0 :(得分:0)
我总结了一个关于你应该怎么做的小解释
function STRPRNButtonStatus( event:MouseEvent )
{
/*change it as per your requirements*/
var stickerToPrint:uint = 8;
var stickerPerPage:uint = 3;
var stickerOnPage:uint = 3;
var pageNum:uint = 0;
/*begin a print job*/
var printJob:PrintJob = new PrintJob();
/*test if start*/
if ( printJob.start() )
{
/*get how many page required*/
var totalPageRequired:uint = Math.ceil( stickerToPrint/stickerPerPage);
for( var i:uint =0; i<totalPageRequired;i++)
{
/*calculate how many sticker already printed*/
stickerOnPage = stickerToPrint - (pageNum*3);
/*now check how many need on this page*/
if( stickerOnPage>3)stickerOnPage = 3;
for( var j:uint =stickerOnPage+1; j<=3;j++)
{
//here you hide the sticker, I simply assume that yourmain sticker contain sticker_1, sticker_2 and sticker_3 movieclips
sticker["sticker_"+j].visible = false;
}
printJob.addPage(sticker);
++pageNum;
}
/* Send print job to printer */
if( totalPageRequired > 0 )printJob.send();
/* Delete job from memory */
printJob = null;
}
}