PrintJob problems in ActionScript 2

What I did mostly today was debug some ActionScript code on printing. All the basics about printing can be found in this tutorial. But as usual, what you want to do is more complicated than the basics. I have to talk a bit about my setup for you to understand the problem. What I usually do for a project, is that I load my content on 3 levels. The first level is the preloader which loads the shell (an external file) on level 2. The shell will load all the other content (also external files) on level 3. Also, because of all the rounded corners, content will be loaded under a mask.

So what I wanted to print was in the content MovieClip. I set out to do was in the tutorial, and everything worked really fine until I wanted to move the printArea MovieClip outside the visible screen (that’s the basic principle to do good printing using ActionScript). The big problem here is that content is under a mask so when I move the printArea out of the mask it become invisible so it won’t print. In order to solve that I had to attach the printArea MovieClip on the shell level (which is not under a mask). It sounds easy, but it took me 2 hours to find.

An other problem I had was that I was trying to offset a bit the stuff that I am printing so that when it prints there is a margin at the top and left. Well it seems that even if you offset (move a bit less and down) it doesn’t work, because for a reason, Flash start printing at the first pixel it encounters top and left. I think to circumvent that, I’ll put a single white pixel at 0, 0 so then my offset will work.

I hear there is also a problem with multiple page printing, but all my pages fit in one page so I did not have to solve that problem also

, ,

  1. #1 by Aaron - September 19th, 2008 at 13:47

    I have a printing issue very similar to what you describe. I need to print a mc but it is masked. How did you solve this exactly? I am a designer not a coder so please break it down for me. I don’t mean to ask that you supply code, just explain your method to work around the mask problem/limitation.

    Thanks in advance for any help you can provide.


  2. #2 by dgelineau - September 19th, 2008 at 16:02

    Basically what you want to do is create your printing mc and attach it somewhere where it is not under the mask so you might have to do something like this._parent.attachMovie to get up one level.

    I’m sorry if this doesn’t help you but printing is a bit technical and it depends a lot on your setup.

(will not be published)
Subscribe to comments feed
  1. No trackbacks yet.