-
how to print in Actionscript
Dear All,
Just like ask if you can help me complete my code to print using actionscript?
its looking for a method in the print() function. Thanks in advance.
mcPrint.addEventListener(MouseEvent.CLICK, clkPrint);
function clkPrint(event:Object):void{
print();
}
Literain
-
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot
The height of cleverness is to be able to conceal it.
- Francois de La Rochefoucauld
-
Thanks. This info is very valuable. Can you pls help me I read thru the text and I had an error:
1120: Access of undefined property params.
pertaining to this line:
my_pj.addPage([params]);
What should I put in the [params]? Or what do you think is the error? Pls advice. Thank you.
Here's the whole code:
var my_pj:PrintJob = new PrintJob();
mcPrint.buttonMode=true;
mcPrint.addEventListener(MouseEvent.CLICK, clkPrint);
function clkPrint(event:Object):void{
// display Print dialog box, but only initiate the print job
// if start returns successfully.
if (my_pj.start()) {
// add specified page to print job
// repeat once for each page to be printed
try {
my_pj.addPage([params]);
}
catch(e:Error) {
// handle error
}
try {
my_pj.addPage([params]);
}
catch(e:Error) {
// handle error
}
// send pages from the spooler to the printer, but only if one or more
// calls to addPage() was successful. You should always check for successful
// calls to start() and addPage() before calling send().
my_pj.send();
}
}
Literain
-
You want to pass a reference to the sprite you want to print.
As MovieClip extends sprite, you should be able to pass pretty much anything that has been added to the stage, but I do not believe you can pass the stage itself.
More detail here:
http://livedocs.adobe.com/flash/9.0/....html#addPage()
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot
The height of cleverness is to be able to conceal it.
- Francois de La Rochefoucauld
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|