Apply Filter to Everything in AS3

試著忘記壹切 提交于 2019-12-02 07:44:30

As I see it, you have two possible approaches:

  • put everthing you want to blur in a separate container as the rest and apply the filters to that container.

  • create a BitmapData of the size of the stage (or the part you want to blur), draw the stage, applyFilter, add it to the the display list (on top of everything) and on top of that add all sprites that shouldn't be blurred (I imagine an alert box or similar). Note that you should update the BitmapData on resize.

UPDATE: Your code seems correct, but I'm not familiar with Flex, so maybe you can't add filters to Canvas (is it a DisplayObject?)... maybe setting his cacheAsBitmap to false works (it's quite buggy sometimes)... anyway, something like this should do the trick:

var container=new Sprite();
myCanvas.addChild(container);
container.addChild(new vectorImage());
container.addChild(new vectorImage2());
container.filters=[blur];

or maybe Canvas has a container property already...

Cheers...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!