Hi!
I need to blur the stage3D. As the Blur3D is not very good to animate, i found a Workaround using BitmapData. So, when i need to blur my scene (because a layer pops up and i don’t need the scene to update anymore) i just call a function that draws the content of Stage3D to a BitmapData. That works fine! Now i encountered a problem: When a user resizes the browser window, also the blurred BitmapData should be updated. If it try to resize the View3D and then call my method for drawing the Stage3D to BitmapData again, everything freezes.
Can somebody see what i do wrong? Is there a “best practice”? or has somebody another hint for me?
here’s my code:
//initial blurring:
public function blurStage3D() : void {
_isBlurred = true;
_renderStage3DToBitmap();
}
private function _renderStage3DToBitmap() : void {
if (_stage3DDuplicateBMD) _stage3DDuplicateBMD.dispose();
_stage3DDuplicateBMD = new BitmapData(AppConfig.stageWidth, AppConfig.stageHeight);
_stage3DView.renderer.swapBackBuffer = false;
_stage3DView.render();
_stage3DView.stage3DProxy.context3D.drawToBitmapData(_stage3DDuplicateBMD);
_stage3DView.renderer.swapBackBuffer = true;
_stage3DDuplicateBM.bitmapData = _stage3DDuplicateBMD;
_stage3DDuplicateBM.filters = [new BlurFilter(20, 20)];
}
//reblurring on resize, BUT THATS NOT WORKING:
if (_stage3DView) {
_stage3DView.width = AppConfig.stageWidth;
_stage3DView.height = AppConfig.stageHeight;
if (_isBlurred){
_renderStage3DToBitmap();
}
}
Thank you very much!!