Re: Printing a .swf embedded w/ wmode transparent

48 views
Skip to first unread message

beez

unread,
Dec 15, 2008, 12:47:00 AM12/15/08
to SWFObject
I have a label printing app that I have embedded into HTML w/ wmode
transparent. I am printing using JavaScript to a div containing
the .swf...no problems.

Does anyone know how to print from html using wmode tranparent: in IE
the the .swf background shows up and in Firefox nothing shows up.

Also does anyone know a way to print in Flash w/ out a background??? I
have already tried printJob in Flash.

Thanks!

-B

Aran Rhee

unread,
Dec 15, 2008, 12:57:06 AM12/15/08
to swfo...@googlegroups.com
Others may know more, but I don't think what you are wanting to do is
possible.

Every browser handles the wmode=transparent (+ printing) in a different way,
so I would be very surprised if you found a cross-browser solution that
works. I have a hard enough time trying to get a normal web page printing as
it should !

The print job class in Flash will not render anything outside of the swf, so
you would need to have whatever content you wanted to print within the swf
(not behind in the HTML page)

Aran

Brad Swords

unread,
Dec 15, 2008, 1:01:41 AM12/15/08
to swfo...@googlegroups.com
Yeah, I am screwed...just trying to save a project.

I appreciate the word.

-B

Aran Rhee

unread,
Dec 15, 2008, 1:58:19 AM12/15/08
to swfo...@googlegroups.com

The only crazy thing I can think to do is take a BitmapData snapshot of the swf (which can maintain 32bit transparency) from within Flash, and then save the image data as an transparent PNG, and recombine the image / other layers as appropriate to print.

 

Something like:

http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash/

 

(PNG version)

http://www.quietless.com/kitchen/upload-bitmapdata-snapshot-to-server-in-as3/

 

 

But using PNG, and pushing the resultant image into the page via AJAX to print and the like.

 

 

As I said, pretty crazy.... (but hey it’s Monday and I live in Australia - we are always a bit crazy down here)

 

 

 

Aran

Brad Swords

unread,
Dec 15, 2008, 12:33:07 PM12/15/08
to swfo...@googlegroups.com
That's a very good idea, and i roughly I roughly considered that option. I may have to do the same. Pls let me know how yours works out.

I was wondering how printing works out for your images w/ alpha. Have you tried this?

Thanks,

Brad

Aran Rhee

unread,
Dec 15, 2008, 6:33:20 PM12/15/08
to swfo...@googlegroups.com

Brad.

 

I have done a project using bitmapdata / saving images using AIR to save an image sequence directly to disk for making backup images (animated GIF / static GIF) for online swf display ads, but never to integrate back into a web page.

 

Re: transparency printing - There are lots of transparent GIFs / PNGs in modern websites which seem to print ok. You could do a pretty quick proof of concept (without doing all of the bitmapdata authoring) with a pre-created image to see if it will work for you...

Getify Solutions

unread,
Dec 16, 2008, 11:34:37 AM12/16/08
to swfo...@googlegroups.com
I would just make the suggestion that perhaps you can cause a print-stylesheet rule to swap in a static image that represents the SWF for when a user is printing... that way the swf appears to be printed along with the page, but in reality it's just an image like everything else.  As suggested before, this image could be a transparent PNG so the design/layering of your page can be maintained.
 
Essentially, you just have the "screen" media style put display:block on the SWF, and display:none on the alternate image. And then for "print" media style, you swap and make the SWF display:none and the image display:block.
 
This doesn't catch the "snapshot" live-action state of the SWF, but it gets pretty close to being the page printed with what appears to be the SWF in there.  In fact, you could get really exotic and have multiple different screenshots of your SWF prepared, and simply pick which one via CSS to have printed depending on where the user was in the timeline of your SWF.
 
--Kyle

Brad Swords

unread,
Dec 16, 2008, 12:04:35 PM12/16/08
to swfo...@googlegroups.com
I think I am going to do the same- just w/ Flash. Yesterday I built/borrowed code to upload a png using PHP, but I am having trouble w/ the bitmap filter keeping the transparency...other than that I think I have this.

-Brad



Thanks, and when I finish I will forward. I am a developer in Berkeley,

Aran Rhee

unread,
Dec 16, 2008, 6:37:52 PM12/16/08
to swfo...@googlegroups.com

Brad.

 

There's a fourth argument you can pass to the BitmapData constructor that defines what your transparent pixels are filled with. The default for this is white (0xFFFFFFFF). So, if all your transparent pixels are white, chances are good you just need to make this slight adjustment to your BitmapData assignment...

 

bitmapData = new BitmapData( bitmap.width, bitmap.height, true, 0x00FFFFFF );

 

// this fill color is a transparent ARGB value, and should give you your transparency you want

 

 

 

Cheers,

Brad Swords

unread,
Dec 16, 2008, 6:42:50 PM12/16/08
to swfo...@googlegroups.com
Yeah, I tried that. The wierd thing is that I can attachBitMap and the alpha channel is preserved, but using this tech:

http://www.quasimondo.com/archives/000645.php

All gone...by the way this thing is very cool.

-B

Aran Rhee

unread,
Dec 16, 2008, 6:54:43 PM12/16/08
to swfo...@googlegroups.com

His server-side script is ignoring the alpha:

 

The main features of BitmapExporter are:
- send any BitmapData object to a PHP server-side script with one line of code (currently alpha channels are ignored for performance reasons)

...”

 

 

I think you need a different server-side script (Or use AS3 so use can encode to PNG on the client-side before sending to the server)

Brad Swords

unread,
Dec 16, 2008, 7:06:31 PM12/16/08
to swfo...@googlegroups.com
OK.. thanks, and i will give that a go...

-B
Reply all
Reply to author
Forward
0 new messages