Hi everyone,
I’m pretty new with Away3D (using 4.1) and flash and I’m trying to save a bitmap of a basic scene containing a cube.
i’m using the following code but nothing get draw on my bitmap when i want to save it.
var image:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x000000);
view.render();
view.renderer.queueSnapshot(image)
//save bitmap image
var jpg:JPGEncoder = new JPGEncoder(100);
var byteArray:ByteArray = jpg.encode(image);
var fileReference:FileReference=new FileReference();
fileReference.save(byteArray, "image.jpg");
And here is my view settings
//setting the view
view = new View3D();
scene = new Scene3D();
camera = new Camera3D();
view.scene = scene;
view.camera = camera;
view.camera.z = -600;
view.camera.y = 500;
view.camera.lookAt(new Vector3D());
addChild(view);
//adding a cube
cube = new Mesh(new CubeGeometry(cubeWidth, cubeHeight, cubeDepth, 1, 1, 1, false), new TextureMaterial(Cast.bitmapTexture(TrinketDiffuse)));
cube.x = 0;
cube.y = 100;
cube.z = 0;
scene.addChild(cube);
I don’t really see what I am doing wrong so if someone could help me it would be most appreciate!
Thanks!