-
1 Attachment(s)
Printing Swf in AS3
Hi all i am facing some problem while printing an swf from another swf movie..
i have two movies A & B, in which B will be loaded to A and will be printed from A using a Print btn in A. The swf B has many layers including vector and jpep files. when i load the movie B to Movie A, its coming properly but, when i give print only the jpeg image which is in the top layer of B, is coming.. i tried printing area of stage also. that also giving the same result.. what is the problem??
here is the code that i have given
print_btn.addEventListener(MouseEvent.CLICK,printC ontent);
function printContent(evt:MouseEvent) {
var printJob:PrintJob = new PrintJob();
if (printJob.start()) {
if (loader_mc.width>printJob.pageWidth) {
loader_mc.width=printJob.pageWidth;
loader_mc.scaleY=loader_mc.scaleX;
}
printJob.addPage(loader_mc);
printJob.send();
}
}
i have attached the two movies.. i am new AS3 and guys please help me!!
-
I remembered opening both your files and there was an error in both of them. Anyway, an alternative is to draw your movie clip A into a bitmap data and contained inside a bitmap. Then convert that into a JPG, and ask user to save the file in their computer. Later, the user can then print from that JPG using their favourite image viewer. You can use FileReference in to write files and ask to browse for saving locations, JPGEncoder and JPGDecoder, I think all included with AS3 package. I used it last year for one of my physics simulation project.
You can also use the method above to print a SWF directly, but you would have to put the bitmap into a Movieclip, then pass that movie clip into a print job, then print it. Print job cannot print things that are not displayed on the stage.