Why does Printing from Javascript in Air happen out of order?
Posted
by Bob Bob
on Stack Overflow
See other posts from Stack Overflow
or by Bob Bob
Published on 2010-04-14T09:58:36Z
Indexed on
2010/04/14
10:03 UTC
Read the original article
Hit count: 267
I am trying to print from an Adobe Air App that embeds an AJAX app.
The print function looks like this:
function printPage() {
asyncSetupForPrint(printCallback);
}
function asyncSetupForPrint(printCallback) {
synchronousMethods();
if (printCallback) printCallback();
}
function printCallback() {
var pjob = new window.runtime.flash.printing.PrintJob;
var psprite = window.htmlLoader;
pjob.start();
// etc...
}
However the print dialog is coming up before the synchronous methods have been executed. Is the AIR JS runtime optimizing something? And if so, is there any way to stop it doing that?
(The setup function is doing things like changing the resolution to huge*huge so that the print out looks ok.)
© Stack Overflow or respective owner