对可见事件的弯曲效果

发布于 2024-12-29 02:29:09 字数 1060 浏览 2 评论 0原文

我想创建一个在可见时应用调整大小效果的组件:

我这样做了:

<s:Panel id="loginPanel" title="Connect" creationCompleteEffect="customResize" 
                             showEffect="customResize" hideEffect="fadeOut"
                             width="400" height="300" includeIn="login">

with:

    <fx:Declarations>
            <!--  Effects declaration  -->
            <s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500"/>
            <s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500"/>
            <s:Animate id="customResize" duration="1000">
                <s:SimpleMotionPath property="percentWidth" valueFrom="0" valueTo="100"/>
                <s:SimpleMotionPath property="percentHeight" valueFrom="0" valueTo="100"/>
            </s:Animate>
        </fx:Declarations>

问题是,当组件第一次显示时,效果可以正确播放,但是当状态发生变化时从“登录”到“工作”再回到“登录”,效果不再播放。

我认为会调度可见性事件并应用 showEffect,但状态更改似乎并不像我预期的那样工作。

如何在组件每次可见时应用效果?

I would like to create a component that apply a resize effect when the it is visible:

I did this:

<s:Panel id="loginPanel" title="Connect" creationCompleteEffect="customResize" 
                             showEffect="customResize" hideEffect="fadeOut"
                             width="400" height="300" includeIn="login">

with:

    <fx:Declarations>
            <!--  Effects declaration  -->
            <s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500"/>
            <s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500"/>
            <s:Animate id="customResize" duration="1000">
                <s:SimpleMotionPath property="percentWidth" valueFrom="0" valueTo="100"/>
                <s:SimpleMotionPath property="percentHeight" valueFrom="0" valueTo="100"/>
            </s:Animate>
        </fx:Declarations>

The problem is that when the component is displayed for the first time, the effect is correctly played but when the state change for example from "login" to "working" then back to "login", the effect isn't played anymore.

I thought that a visibility event would have been dispatched and the showEffect applied but it seems that the state changes don't work like I was expecting.

How can I apply the effect each time the component is visible?

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

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

发布评论

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

评论(1

思念满溢 2025-01-05 02:29:09

您确定各州正在切换可见属性吗?
尝试强制更改 Visible 属性:

<s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500" effectStart="loginPanel.visible = true"/>

<s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500" effectEnd="loginPanel.visible = false"/>

are you sure the states are toggling the visible property?
Try to force Visible property to change:

<s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500" effectStart="loginPanel.visible = true"/>

<s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500" effectEnd="loginPanel.visible = false"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文