PDA

View Full Version : Print capture + formatted text on A4



masster
February 1st, 2006, 10:46 AM
Hello,
I would need your help in solving a less common issue in Flash: printing parts of a scene + some other info on a A4 size page.

Here's how my input scene looks like:
http://www.masster.ro/test/in.jpg

Here's how i would like my PRINTED output look like:
http://www.masster.ro/test/out.jpg

All should be done by clicking a 'Print' button in my scene.
As you can see, on top of the generated page it is a region capture of my scene and below there is some formatted text. Info for those texts are already in some arrays.

Can it be done and if yes, can you share some coding tips, please?

Thank you.

joene
February 1st, 2006, 11:33 AM
If the kitchen is a seperate movieclip, it's pretty simple: you can use the PrintJob object.
This is just a quick example, be sure the checkthe helpfile for more detailed info.

ActionScript Code:

var myPJ:PrintJob = new PrintJob();

if (myPJ.start()) { // displays the print dialog
myPJ.addPage("kitchen_mc", {xMin:0, xMax:kitchen_mc._width, yMin:0, yMax:kitchen_mc._height});
myPJ.send(); // print
}

delete myPJ;

masster
February 1st, 2006, 11:53 AM
thank you, joene
indeed PrintJob is a powerful class and pretty much solves my issue.

But there's a catch though: ok, I could group my things in the scene so that my walls and floor are in the same movie. But what about the furniture modules that are added in an interactive drag&drop way? They are each one separate movies and are stacked on top of my scene movie... How could I 'persuase' :) them appear in my final print? And hopefully without the floating toolbar and stuff.

joene
February 1st, 2006, 02:20 PM
I guess a possible solution would be: taking a "screenshot" of your stage through the BitmapData class, and printing that. So that everything that's placed on the stage through d&d still will be printed. Sounds kind of crappy now that I'm saying it though...
There's a tutorial at www.gotoAndlearn.com on how to create such a screenshot. Hope it helps :)

masster
February 1st, 2006, 03:35 PM
crappy or not, it solves the problem. And that's most important. thx again for link also. very nice.