I’m trying to print a varying amount of data, 1 - 137 pages of information, depending on where you are in my .swf movie. I can print smaller amounts of data, but when I try to print larger amounts, I recieve the timeout error. here’s my code
var spArray:Array = [];
var spp:Sprite = new Sprite();
var storeTime:Number = 0;
var storeDifference:Number = 0;
var storeDifference2:Number = 0;
function printAll2(e:MouseEvent){
spArray = [];
var spLoad:Loader = new Loader();
trace(xml.child("*").length());
for(var i:int = 0; i < xml.child("*").length(); i++){
for(var j:int = 0; j < xml.child(i).child("*").length(); j++){
var strrr:String = new String(xml.child(i).child(j).@url.toString());
var spURL:URLRequest = new URLRequest(strrr);
spLoad = new Loader();
spLoad.load(spURL);
spp = new Sprite();
spp.addChild(spLoad);
spp.name = xml.child(i).child(j).@id;
spArray.push(spp);
addChild(spp);
spp.x = stage.stageWidth + 10;
}
}
var time:int = 1000;
setTimeout(buffer, time);
}
var iii:int = 0;
function buffer(){
printEverything();
}
function printEverything(){
iii = 0;
var startPrint2:PrintJob = new PrintJob();
var rect2:Rectangle = new Rectangle(0, 0, 600, 800);
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = false;
trace(getTimer()+ " = getTimer()");
var boo3:Boolean = startPrint2.start();
trace(boo3 + " = boo3" );
if (boo3) {
while(iii<spArray.length){
trace(iii + " = iii spArray.length = " + spArray.length + " " + getTimer()+ " = getTimer()");
startPrint2.addPage(spArray[iii], rect2, options);
iii += 1;
}
startPrint2.send();
}
}
If I remove the timeOut functions, all 137 pages will spool, but they will only be pages that are completely blue. With the smaller sections(a different set of code than I had previously provided), The timeout function seems to work, although My latest tests have pages not being spooled to the printer.
Notice from the code example how I am loading the .swfs (the urls are stored in an xml file)before I am spooling to the printer app.
I’m using PrimoPDF to ‘print’ the pages. I was using AdobePDF but it is behaving differently from PrimoPDF in that it will not print the complete section where PrimoPDF will. Bizarre.
Here’s how I feel:
Any help would be truly appreciated.