Flash Actionscript 3,执行printjob后文件更改

Flash Actionscript 3,执行printjob后文件更改,flash,actionscript,printing,sprite,stage,Flash,Actionscript,Printing,Sprite,Stage,我有一个按钮,这个按钮的相关功能有打印舞台部分的任务。问题是,打印后,特定部分会以图像的形式出现在舞台顶部。我已经使用removechild将精灵从舞台上移除,但我认为问题出在其他地方。 如果有人能帮助我,我将不胜感激 var printJob:PrintJob = new PrintJob(); var options:PrintJobOptions = new PrintJobOptions(); options.printAsBitmap = false; printJob.start(

我有一个按钮,这个按钮的相关功能有打印舞台部分的任务。问题是,打印后,特定部分会以图像的形式出现在舞台顶部。我已经使用removechild将精灵从舞台上移除,但我认为问题出在其他地方。 如果有人能帮助我,我将不胜感激

var printJob:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = false;

printJob.start();
var bitmapData:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight);
bitmapData.draw(stage);
var bitmapDataA:BitmapData = new BitmapData(700,460);
bitmapDataA.copyPixels(bitmapData, new Rectangle(0, 270, 700, 800), new Point(0, 0));

//convert bitmapdata to bitmap to sprite
var screenShot:Bitmap = new Bitmap(bitmapDataA);
addChild(screenShot);
var axSprite:Sprite = new Sprite();
axSprite = (bitmapToSprite(screenShot));

//========== printjob bug fix - prevent blank pages: ==========
axSprite.x = 2000;//keep it hidden to the side of the stage
//axSprite.y = 2000;
stage.addChild(axSprite);
//add to stage - prevents blank pages;
//=============================================================

var myScale:Number;
myScale = Math.min(printJob.pageWidth/axSprite.width, printJob.pageHeight/axSprite.height);
axSprite.scaleX = axSprite.scaleY = myScale;
var printArea:Rectangle = new Rectangle(0,0, printJob.pageWidth/myScale, printJob.pageHeight/myScale);

printJob.addPage(axSprite, printArea, options);
printJob.send();


stage.removeChild(axSprite);
axSprite = null;
printJob = null;

您正在将
屏幕截图
实例添加到
显示列表
此处:

//convert bitmapdata to bitmap to sprite
var screenShot:Bitmap = new Bitmap(bitmapDataA);
addChild(screenShot);
var axSprite:Sprite = new Sprite();
axSprite = (bitmapToSprite(screenShot));
我不确定您为什么需要这样做,但如果需要,请确保稍后再次删除:

stage.removeChild(axSprite);
removeChild(screenShot);
axSprite = null;
printJob = null;