Dear Flashcoders, I need to find a solution to the said problem: I have an swf with a "printAll" function that prints out the content of a multiple frames mc that loads at runtime. Since the Flash.PrintJob class has a built in 15 second Timeout between every subsequent PrintJob.start()/PrintJob.addPage()/PrintJob,send() I get Timeout Errors when the spooling of the pages takes to long. I need to find a way to catch this error and at least reset my swf (I do some scaling to fit to the Print size and reset that later on). Right now I only catch Errors when the user cancels the print job or another error occurs on printing but not the Timeout. Anyway, here's what I tried to date:
///___________________ var counter=1; var myPrintJob:PrintJob; var currFrame; var options:PrintJobOptions = new PrintJobOptions(); options.printAsBitmap = false; function printHandler(event:MouseEvent) { counter=0; myPrintJob=new PrintJob(); var printTrigger=event.target.name; currFrame=ref.currentFrame; reset_mc(); //alles drucken if (printTrigger=="print_btn") { for (var i=1;i<=ref.totalFrames;i++) { dispatchEvent(new Event("addNewPage")); } } } function OnAddNewPage(e:Event) { try { counter++; if(counter==1) { trace("started") myPrintJob.start(); } //setze Printbreite if (ref.width>myPrintJob.paperWidth) { ref.width=myPrintJob.paperWidth; ref.scaleY=ref.scaleX; } trace("adding "+counter) ref.gotoAndStop(counter); myPrintJob.addPage(ref,null,options); if(counter==ref.totalFrames) { trace("sent") myPrintJob.send(); myPrintJob=null; //mc zurücksetzen reset_mc(); } } catch(error:Error) { //mc zurücksetzen trace("print error: "+error); myPrintJob=null; reset_mc(); return; } catch(e:ScriptTimeoutError) { // ScriptTimeoutError: Error #1502: A script has executed for longer than 15 seconds trace("Timeout: "+e); reset_mc(); myPrintJob=null; return; } } function reset_mc() { //mc zurücksetzen //trace("resetting"); } ///_________________________ Thanks for any input on this.... Thomas _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders