(resend as appears to have vanished) On Tuesday 04 July 2006 15:47, Tom Chiverton wrote: > Has anyone else had problems using the printJob classes ?
If I try and print a dynamicaly instantiated GUI component, the job silently fails. If I create the same component in line in the page, the job works well. Please can someone confirm this and/or an Adobe person take a look ? In the below example (of it not working) change printJob.addObject(formPrintView, FlexPrintJobScaleType.MATCH_WIDTH); to printJob.addObject(thePrintView, FlexPrintJobScaleType.MATCH_WIDTH); to get the working behaviour. test.mxml: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:print="com.halliwells.flex.archiving.*" height="100%" width="100%"> <mx:Script > <![CDATA[ import mx.printing.*; import mx.controls.Alert; private function alertClickHandler(event:Object):void { var printJob:FlexPrintJob = new FlexPrintJob(); // Start the print job. if(printJob.start()){ // Create a MyPrintView control as a child of the current view. var formPrintView:CoverSheetPrintView = new CoverSheetPrintView(); addChild(formPrintView); formPrintView.file=fileModel; // Add the SimplePrintview control to the print job. // For comparison, try setting the second parameter to "none". printJob.addObject(formPrintView, FlexPrintJobScaleType.MATCH_WIDTH); // Send the job to the printer. printJob.send(); // Remove the print-specific control to free memory. //removeChild(formPrintView); }else{ Alert.show("Argh, can't start"); } } ]]> </mx:Script> <mx:Model id="fileModel"> <xml> <file_id>0123456</file_id> <file_ref>My ref</file_ref> <file_desc> a nice logn description that goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and </file_desc> </xml> </mx:Model> <print:CoverSheetPrintView id="thePrintView" file="{fileModel}"/> <mx:Button label="print" click="alertClickHandler(event)" /> </mx:Application> CoverSheetPrintView.mxml: <?xml version="1.0"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF"> <mx:Script > <![CDATA[ [Bindable] public var file:Object; private function addStars(str:String):String{ return '*'+str+'*'; } ]]> </mx:Script> <mx:Label text="{file.file_id}"/> <mx:HBox> <mx:Label text="Name"/> <mx:Label text="your name here" /> </mx:HBox> <mx:HBox> <mx:Label text="File ref:"/> <mx:Label text="{file.file_ref}" /> </mx:HBox> <mx:HBox> <mx:Label text="Description"/> <mx:Text text="{file.file_desc}" width="600" height="600"/> </mx:HBox> </mx:VBox> -- Tom Chiverton **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/