3 Replies Latest reply on Mar 14, 2017 8:40 AM by kglad

    Printing without dialog box

    jackh8500410 Level 1

      Hi,

       

      I'm making a maths learning app for kids using AS3. I have a page with a certificate and want to make a button which prints to the default printer with no printer dialog box.

       

      The code I have;

      pLvl1Print.addEventListener(MouseEvent.CLICK, printContent);

       

      function printContent(evt: MouseEvent) {

        var pj: PrintJob = new PrintJob();

        var started = pj.start2(null, false);

        if (started) {

        pj.addPage(content_mc);

        pj.send();

        };

        pj = null;

      }

       

      The error I get:

      plusLvl1Cert, Layer 'actions', Frame 80, Line 7, Column 191061: Call to a possibly undefined method start2 through a reference with static type flash.printing:PrintJob.

       

      The problem line of code is in bold.

       

      Can anyone point me in the right direction? The other post's I've found don't seem helpful to me.

       

      Thanks

      Jack