Wednesday, 28 March 2012

Creating the print outs on the Colour In page

I wanted the children to be able to print out a picture of Ali the Aligator for them to colour in. So I searched online for a tutorial on how to add a print button and found one and followed that. I made outline drawings of the him standing and playing basketball in Adobe Illustrator. I then imported the outline drawings in flash and saved them as movie clips and called them mc_printContent01 and mc_printContent02. I then created two print buttons and added them underneath the two outline drawings. Then I added the following code in my actionscript layer for the Colour In page to enable the children to print out their own picture.

print_button1.addEventListener(MouseEvent.CLICK, onPrintButton1);


function onPrintButton1(evt:MouseEvent) {
var printJob:PrintJob = new PrintJob();
if (printJob.start()) {
if (mc_printContent01.width>printJob.pageWidth) {
mc_printContent01.width=printJob.pageWidth;
mc_printContent01.scaleY=mc_printContent01.scaleX;
}
printJob.addPage(mc_printContent01);
printJob.send();
}
}



print_button2.addEventListener(MouseEvent.CLICK, onPrintButton2);

function onPrintButton2(evt:MouseEvent) {
var printJob:PrintJob = new PrintJob();
if (printJob.start()) {
if (mc_printContent02.width>printJob.pageWidth) {
mc_printContent02.width=printJob.pageWidth;
mc_printContent02.scaleY=mc_printContent02.scaleX;
}
printJob.addPage(mc_printContent02);
printJob.send();
}
}

So once this code was added the children could print out their own outline drawing of Ali to colour in by clicking on the print out buttons as per screenshot below.

No comments:

Post a Comment