我在添加到工作区域的任何元素之上都有一个png图像。用户可以单击并将新元素拖动到该区域,然后打印他们创建的图片。 png图像不可移动。 png图像充当背景图像或用作用户图片的容器。
当我尝试打印时,png图像不显示。我得到的元素很好,但就是这样。如果我改变了一些东西,我只能打印png图像而不能打印元素。如何让它们一起打印?
//This puts my png image on top and unclickable
stage.addChild(seal);
seal.mouseEnabled = false;
//this brings the current element to the front
for (var fl_ChildIndex_5:int = 0;
fl_ChildIndex_5 < this.numChildren;
fl_ChildIndex_5++) {
this.getChildAt(fl_ChildIndex_5).addEventListener(MouseEvent.CLICK, fl_ClickToBringToFront_5);
}
function fl_ClickToBringToFront_5(event:MouseEvent):void {
this.addChild(event.currentTarget as DisplayObject);
}
//This is my print button
var button:Sprite = new Sprite();
button.graphics.beginFill(0xf67821, 1);
button.graphics.drawRect(0, 0, 120, 60);
button.graphics.endFill();
addChild(button);
button.addEventListener(MouseEvent.CLICK, printContent);
var myArea:MovieClip = root as MovieClip;
var myRectangle:Rectangle = new Rectangle(150,0,700,500);
function printContent(event:MouseEvent) {
var printJob:PrintJob = new PrintJob();
if (printJob.start()) {
if (myArea.width > printJob.pageWidth){
myArea.width = printJob.pageWidth;
myArea.scaleY = myArea.scaleX;
{printAsBitmap:true};
}
printJob.addPage(myArea, myRectangle);
}
printJob.send();
printJob = null;
}
最新代码
var workingarea:MovieClip = new MovieClip();
stage.addChild(workingarea);
var seal:Sprite = new Sprite();
seal = new SealImg();
seal.x = 475;
seal.y = 271;
workingarea.addChild(seal);
seal.mouseEnabled = false;
seal.mouseChildren = false;