0

I have an application that consist of a 3D view and some 2D views. The problem occurs when I try to print one of the 2D views. The 3D view disappears after the printing has been performed.

I have replicated the problem with the Basic_Load3DS example from the Away3D. I added a red button for initiating the print job. The PrintJob prints the button and has nothing to do with the 3D view but the ant disappears after the printing is done.

You can try it here. Click on the red button and then OK in the printing dialogue that appears for the problem to occur. View source is available.

Here is the code that I added to the Basic_Load3DS example

private var _btn:Sprite;
protected function initExtra():void
{
 _btn = new Sprite();
 addChild(_btn);
 _btn.graphics.beginFill(0xff0000);
 _btn.graphics.drawRect(0, 0, 100, 100);
 _btn.y = 100;
 _btn.addEventListener(MouseEvent.CLICK, print);
}
protected function print(e:Event):void
{
 var tPJ:PrintJob = new PrintJob();
 if (tPJ.start())
 {
  tPJ.addPage(_btn); //This line cause the problem
  tPJ.send();
 }
} 

Nothing goes wrong if I comment out the line tPJ.addPage(_btn); 

Any ideas on how to solve this problem? I’m in urgent need of a solution!

Andrium
  • 103
  • 6

1 Answers1

0

If you're trying to draw the entire 3D scene, you're trying to draw something that exists on the GPU, and not the CPU. You'll have to draw the scene into a bitmap, then print it.

flash.display.Context3D.drawToBitmapData;

Secondly, you're just drawing a button? Try creating a bitmap, then using drawtobitmapdata, then draw the stage -- this should give you the desired results.

ansiart
  • 2,563
  • 2
  • 23
  • 41
  • I'm not trying to draw the entire 3D scene, I'm only printing 2D parts, and the print result is just fine. The problem is that the 3D scene disappears in the application on the screen after the printing has been done. I'm only printing a button in the examples since it's just an example. The real application prints more usable things but in the same manner. So I'm not having problems creating a print, I'm having problems with the 3D disappearing on the screen after the print is done. – Andrium Jun 22 '12 at 05:55
  • ah i see. This is most likely a bug then, and should be reported. – ansiart Jun 22 '12 at 14:38