Hey guys, is there anyway I can print a masked shape?
I'm doing a drawing application, and the 'paint' on it is a mask. When I try to print, it either prints only the whole mask, or only the shape, all in black.
Any help is much appreciated!
Printable View
Hey guys, is there anyway I can print a masked shape?
I'm doing a drawing application, and the 'paint' on it is a mask. When I try to print, it either prints only the whole mask, or only the shape, all in black.
Any help is much appreciated!
How do you create the mask, probably not by code?
hi cancerinform, thanks for the reply.
And yes, the mask is created by code...I believe its this one (I'm new on AS3...if its not, please tell me.)
maskmovieclip.cacheAsBitmap = true;
draw.cacheAsBitmap = true;
maskmovieclip.mask = draw;
no one? :(
This works. You have a MovieClip mc on the stage and another Movieclip myMask as a mask over it. Then you have a function with a printjob.
PHP Code:import flash.events.MouseEvent;
import flash.printing.PrintJob;
mc.mask = myMask;
addEventListener (MouseEvent.CLICK, ch);
function ch (e:MouseEvent)
{
var pj:PrintJob = new PrintJob();
if (pj.start())
{
try
{
pj.addPage (mc);
}
catch (e:Error)
{
// handle error
}
}
pj.send ();
}
I gave it a try, cancer...but, as I said, it's only printing the shape in black, or printing the whole mask...
I'm trying to print both at the same page...I believe this is not possible using PrintJob?
sorry for me being such a noob.
The script I provided prints only the masked area in the correct color. To print anything from flash you can only use the printjob.
that's odd...i did the code exactly as you did, but it prints the stupid whole mask..
here's the printJob code.
PHP Code:function imprime (e:MouseEvent){
var imprime:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
if(imprime.start()) {
try {
imprime.addPage(maskmovieclip);
} catch(e:Error) {
// do nothing
}
imprime.send();
}
}
It will print the mask only when the mask is the object to print and when the mask does not function as the mask.
stupid me, I forgot to set the mask in the function. It worked pretty well.
thank you very very very much, cancerinform!