Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Printing without dialog box

Participant ,
Mar 14, 2017 Mar 14, 2017

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

348
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 14, 2017 Mar 14, 2017

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

Translate
Community Expert ,
Mar 14, 2017 Mar 14, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 14, 2017 Mar 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2017 Mar 14, 2017
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines