After initial delight that snapshotting the bitmap data from a stage3d view is now really really easy, I’ve spent the last couple of days banging my head against a brick wall trying to use the bitmap data as the background for the view.
After getting nowhere, (always getting a white rectangle), tonight I decided to instead use the same code which I had used elsewhere to see what was going wrong…
So:
var stageBMD:BitmapData = new BitmapData(view.width, view.height);
view.renderer.queueSnapshot(stageBMD);
var stageBitmap:Bitmap = new Bitmap(stageBMD);
var stageMC:MovieClip = new MovieClip();
//swapping these to test:
stageMC.addChild(stageBitmap);
//stageMC.addChild(defaultCase);
var targetHeight:int = 256;
var targetWidth:int = 256;
stageMC.scaleX = targetWidth / stageMC.width;
stageMC.scaleY = targetHeight / stageMC.height;
var scaledBMD: BitmapData = new BitmapData(stageMC.width,stageMC.height);
addChild(stageMC);
scaledBMD.draw(stageMC);
var scaledBM:Bitmap = new Bitmap(scaledBMD);
view.background = new BitmapTexture(scaledBMD);
And weirdly, if I use the defaultCase bitmap, it works as expected, but if I try to use the stage bitmap, although I can add it to the stageMC (not necessary I know, but it was how my other code was working so I wanted to be sure), scale it, and add it to the stage, and it is visible as you’d expect, if I try to draw that stageMC into scaledBMD I just get a white rectangle…
Really confused :S