Skip to main content
Inspiring
March 14, 2017
Answered

Printing without dialog box

  • March 14, 2017
  • 1 reply
  • 401 views

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

This topic has been closed for replies.
Correct answer kglad

you must be publishing an air project to use start2().

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
March 14, 2017

you must be publishing an air project to use start2().

Inspiring
March 14, 2017

Ah thanks. I'll stick with the dialog box appearing - I've just seen your post on another thread saying it's not possible.

Thanks again,

Jack

kglad
Community Expert
Community Expert
March 14, 2017

you're welcome.