1

I want to save Flare3d scene as a png file using actionscript

this what I have tried , i am able to save file but image is not transparent(it is showing black background) which i want to remove

var bmpd:BitmapData = new BitmapData(scene.viewPort.width, scene.viewPort.height,true,0x00000000 );
scene.context.clear();
scene.render();

scene.context.drawToBitmapData( bmpd );

var ba:ByteArray = PNGEncoder.encode(bmpd);

var file:FileReference = new FileReference();
file.addEventListener(Event.COMPLETE, saveSuccessful1);

file.save(ba, "image3d.png");

Saved image using this code

is there any better way to this to get transparent image

thanks

Rahul Lalit
  • 416
  • 2
  • 10

2 Answers2

0

It actually created transparent image

The last property of BitmapData is fill color, which will fill with what ever you said

var bmpd:BitmapData = new BitmapData(scene.viewPort.width, scene.viewPort.height,true,0xFFFFFF );

It will fill with white background now

dejjub-AIS
  • 1,501
  • 2
  • 24
  • 50
0

Easy peasy, just set zero alpha in scene.context.clear(0,0,0,0);

Of course, you already correctly set BitmapData to transparent and 0 fill color.

Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60