Flex 4 Spark 模糊滤镜问题

发布于 2024-11-15 22:01:38 字数 525 浏览 2 评论 0原文

我正在尝试创建自己的模态窗口(内置的弹出管理器不适用于此应用程序)并使窗口后面的对象变得模糊。下面的代码显然是错误的,因为它不起作用,但有人可以指出我正确的方向吗?我是否必须手动模糊窗口后面的每个对象?

<s:Button label="Testing" left="512" top="300">     
</s:Button>
<s:Rect width="1024" height="768" alpha=".5">
    <s:fill>
        <s:SolidColor color="#000000">              
        </s:SolidColor>
    </s:fill>
    <s:filters>
        <s:BlurFilter>              
        </s:BlurFilter>
    </s:filters>
</s:Rect>

I'm trying to create my own modal window (the built in popup manager won't work for this application) and get objects behind the window to be blurred. The code below is obviously wrong since it doesn't work but can someone point me in the right direction? Do I have to manually blur each object behind the window?

<s:Button label="Testing" left="512" top="300">     
</s:Button>
<s:Rect width="1024" height="768" alpha=".5">
    <s:fill>
        <s:SolidColor color="#000000">              
        </s:SolidColor>
    </s:fill>
    <s:filters>
        <s:BlurFilter>              
        </s:BlurFilter>
    </s:filters>
</s:Rect>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哽咽笑 2024-11-22 22:01:38

您的代码显然只会模糊那个黑色矩形,而不是其他任何东西。这里的问题是您想要模糊整个应用程序(模式窗口除外)。

我可以想到两种解决方案:

解决方案 1

将整个应用程序放在一个单独的类中,并将过滤器应用于该类:(

<s:Application>

    <s:States>
        <s:State name="normal" />
        <s:State name="modal" />
    </s:States>

    <view:Main>
        <view:filters.modal>
            <s:BlurFilter>
        </view:filters.modal>
    </view:Main>

    <s:Group includeIn="modal">
        <view:ModalWindow />
    </s:Group>
</s:Application>

这不是一个工作代码示例:其目的只是传达想法)

< strong>解决方案2

在窗口弹出之前截取应用程序的屏幕截图(创建位图)。将该图像放在您的应用程序上,然后将模糊滤镜应用到该图像。然后放置模态窗口。由于图像覆盖了所有内容,因此您无法单击任何内容,但这正是您希望模态窗口出现的行为。

Your code is obviously just going to blur that black rectangle and nothing else. The issue here is that you want to blur the entire application, except the modal window.

I can think of two solutions:

solution 1

Put your entire application in a separate class and apply the filter to that:

<s:Application>

    <s:States>
        <s:State name="normal" />
        <s:State name="modal" />
    </s:States>

    <view:Main>
        <view:filters.modal>
            <s:BlurFilter>
        </view:filters.modal>
    </view:Main>

    <s:Group includeIn="modal">
        <view:ModalWindow />
    </s:Group>
</s:Application>

(this is not a working code sample: its purpose is just to convey the idea)

Solution 2

Take a screenshot of your app (create a BitMap) before the window pops up. Place that image over your app and apply the blur filter to that image. Then place the modal window. You couldn't click on anything because of the image overlaying everything, but that's the behavior you want from a modal window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文