dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: how to print in Actionscript

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    9

    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

  2. #2
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    There is some stuff in the livedocs:
    http://livedocs.adobe.com/flash/9.0/...ge-detail.html
    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

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    9
    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

  4. #4
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center