View Full Version : when printing a png from flash, the transparent areas appear black
halfasleeps
12-16-2008, 06:24 PM
I have a class that takes a ring the user designed and places it over a background and prints it out.
The image is a sprite class with several png's in it. They are all printing inside a black bounding box where the transparency is supposed to be. I am adding a background though behind all the pngs.
Anyways I am supposed to have this done by the end of the day. Does anyone know how to stop the transparent areas from turning black when printing??
Thanks!!!!!
creatify
12-16-2008, 06:59 PM
setting printAsBitmap to true should resolve this:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/printing/PrintJobOptions.html#printAsBitmap
halfasleeps
12-16-2008, 07:00 PM
so I have been doing some research and I guess you are supposed to set printAsBitmap to true but as soon as I do that it just prints out a blank white piece of paper? :mad:
creatify
12-16-2008, 07:01 PM
are you getting errors? can you post your code?
halfasleeps
12-16-2008, 07:03 PM
setting printAsBitmap to true should resolve this:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/printing/PrintJobOptions.html#printAsBitmap
here is the entire class just to print.
THANKS!!
package {
import flash.display.*;
import flash.printing.*;
import flash.events.*;
import flash.utils.Timer;
import flash.geom.Rectangle;
public class Presentation extends Sprite {
private var _timer:Timer;
public function Presentation (ring:Ring = null)
{
if(ring){
this.addChild(ring);
ring.x = 30;
ring.y = 100;
ring.addEventListener(Event.INIT, startTimer);
this.scaleX = this.scaleY = .75;
}else{
this.scaleX = this.scaleY = .75;
printForm();
}
}
private function startTimer(e:Event):void
{
_timer = new Timer(200,1);
_timer.addEventListener(TimerEvent.TIMER,printForm );
_timer.start();
}
function printForm(e:Event = null) {
var my_pj:PrintJob = new PrintJob();
//var rect:Rectangle = new Rectangle(0,0,width,height);
if (my_pj.start()) {
try {
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
my_pj.addPage(this,null,options);
}
catch(e:Error) {
// handle error
trace("printing error");
}
my_pj.send();
}
}
}
}
halfasleeps
12-16-2008, 07:05 PM
so if I change the line:
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
my_pj.addPage(this,null,options);
to just my_pj.addPage(this); it prints but has the black square but with the options I get no error and just prints out a blank paper.
creatify
12-16-2008, 07:18 PM
I'm outa ideas here - I don't see anything glaring in your code.
halfasleeps
12-16-2008, 07:21 PM
I'm outa ideas here - I don't see anything glaring in your code.
Thanks I find it incredibly strange that id I keep everything exactly the same only change
options.printAsBitmap = true;
to
options.printAsBitmap = false;
it prints (but with black transparency blocks)
I googled this and found some other people experiencing the issue but haven t found any solutions yet.
Thanks for your help anyways creatify
creatify
12-16-2008, 07:26 PM
yeah, from what I found, seems like it could just be your printer - can you send it to a different printer or have someone else test it? One other solution would be to try using bitmapdata to draw a "copy" of your artwork to a completely new sprite. Not sure if that will have better results. Good luck and let us know if you find a solution.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.