Hi!
How make correct print command or action? When use standard print command from flash player menu (exe tour) - print result is black rectangle. Exist right solution for this problem?
Alex
Print command - black area
-
-
Hi,
sorry, there is no support for printing,
best regards,
Klaus -
sorry, there is no support for printing,
Why?Here is my homemade print-plugin:
Code
Display Morepackage { import flash.display.Sprite; import flash.events.*; import flash.printing.PrintJob; import flash.printing.PrintJobOptions; import flash.printing.PrintJobOrientation; import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Rectangle; import flash.geom.Matrix; import krpano_as3_interface; public class main extends Sprite { private var krpano : krpano_as3_interface = null; private var pluginobject:Object = null; public function main() { if (stage == null) { addEventListener(Event.ADDED_TO_STAGE, startplugin); addEventListener(Event.REMOVED_FROM_STAGE, stopplugin); } } private function startplugin(evt:Event):void { this.removeEventListener(Event.ADDED_TO_STAGE, startplugin); if (krpano == null) { // setup krpano interface krpano = krpano_as3_interface.getInstance(); pluginobject = krpano.get("plugin[doprint]"); pluginobject.printfunction = doprints; } } private function stopplugin(evt:Event):void { //STOP } private function doprints():void { var myPrintJob:PrintJob = new PrintJob(); var options:PrintJobOptions = new PrintJobOptions(); var frame:Sprite = new Sprite(); var bitmap:BitmapData = new BitmapData (stage.stageWidth, stage.stageHeight); var matrix:Matrix = new Matrix(); var pjorientation:PrintJobOrientation = new PrintJobOrientation(); var wstage:Number = stage.stageWidth; var hstage:Number = stage.stageHeight; var rect1:Rectangle = new Rectangle(0, 0, wstage, hstage); bitmap.draw(stage.root); frame.graphics.beginBitmapFill(bitmap, matrix, true); frame.graphics.drawRect(0, 0, wstage, hstage); frame.graphics.endFill(); addChild(frame); options.printAsBitmap = true; if (myPrintJob.start()) { try { myPrintJob.addPage(frame, rect1, options); } catch (error:Error) { // Handle error, } myPrintJob.send(); } removeChild(frame); } } }
In XML call for example:Code<plugin name="doprint" url="doprints.swf" /> <contextmenu> ... <item name="item_print" caption="Print" onclick="plugin[doprint].printfunction();" /> ... </contextmenu>
Sorry for small errors. But this code working -
Hi,
sorry, there is no support for printing,
Why?
okay, great that it's working,
I should better say - no direct/automatic support for printing
best regards,
Klaus -
I know this thread is slightly old now......
...but is this available as a plugin anywhere ? I don't have the facility to compile a swf file at the moment.
Thanks
Steve
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!