I need to be able to print an image that has been externally loaded on to the stage…
I have no trouble printing text from an XML file, and I can also load the image, but for some reason it doesn’t want to print out…
public function finishPrint(select):void
{
var myPrintJob:PrintJob = new PrintJob();
var printStart:Boolean = myPrintJob.start();
var rectToPrint:flash.geom.Rectangle;
var options:PrintJobOptions = new PrintJobOptions();
var footer:TextField = new TextField();
var txt:TextField = new TextField();
options.printAsBitmap = true;
sheet = new MovieClip();
txt.styleSheet = css;
txt.height = 650;
txt.width = 500;
txt.wordWrap = true;
txt.htmlText = myXML.s13_4_1.text();
footer.styleSheet = css;
footer.wordWrap = true;
footer.height = 150;
footer.width = 500;
footer.y = 730;
footer.htmlText = "<p><small>"+myXML.s13_8.FOOTER.text()+"</small></p>";
loadIMG("images/image01.jpg");
imageMc.cacheAsBitmap = true;
sheet.addChild(imageMc);
sheet.addChild(txt);
sheet.addChild(footer);
rectToPrint = new Rectangle(-30,-10,880,800);
addChild(sheet);
if(printStart){
try{
trace("printing...");
myPrintJob.addPage(sheet,rectToPrint,options);
myPrintJob.send();
}
catch(error:Error){
trace(error);
}
}
removeChild(sheet);
myPrintJob = null;
return;
}