弹性过渡效果适用于第二次和过渡后,但不适用于第一次过渡

发布于 2024-09-01 21:53:18 字数 802 浏览 3 评论 0原文

我有一个灵活的应用程序,可以通过按钮切换在两种状态之间转换。我的问题是,淡入淡出的效果似乎只在第二次转换及之后起作用。然而,对于我的第一次转换...从 State1 到 StudyState...没有任何淡入淡出效果,事实上 state1 中的组件完全消失(页脚填充了“主体”原来所在的空白),然后Flex 重新创建了 StudyState(没有任何淡入淡出,仅在 StudyState 中用组件重新填充“主体”)。

然而,在第一次转换之后,在 StudyState 和 State1 之间工作完全正常。为什么会发生这种情况,我怎样才能做到这一点,以便交叉淡入淡出从第一个转换开始工作?请帮忙!

 <s:transitions>
 <s:Transition id="t1" autoReverse="true">
 <s:CrossFade
  target="{holder}" 
  duration="1500" />
 </s:Transition>
 </s:transitions>
 <s:states>
 <s:State name="State1" />
 <s:State name="studyState" />
 </s:states>

<s:VGroup id="globalGroup" includeIn="State1" width="100%">stuff</Vgroup>
<s:VGroup id="studyGroup" includeIn="studyState" width="100%">stuff</Vgroup>

i have a flex app that transitions between 2 states with the toggle of a button. my issue is that the effect of fading only seems to work on the 2nd transition and after. However, for my first transition... going from State1 to studyState... there is no fade effect whatsoever, in fact the components in state1 disappear completely (the footer fills the empty gap where the "body" use to be) and then the flex recreates the studyState (without any fade refilling the "body" with components only in studyState).

After this first transition however, going between studyState and State1 working COMPLETELY fine.. why does this happen and how can i make it so that crossfade works STARTING FROM THE VERY FIRST TRANSITION? please help!

 <s:transitions>
 <s:Transition id="t1" autoReverse="true">
 <s:CrossFade
  target="{holder}" 
  duration="1500" />
 </s:Transition>
 </s:transitions>
 <s:states>
 <s:State name="State1" />
 <s:State name="studyState" />
 </s:states>

<s:VGroup id="globalGroup" includeIn="State1" width="100%">stuff</Vgroup>
<s:VGroup id="studyGroup" includeIn="studyState" width="100%">stuff</Vgroup>

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

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

发布评论

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

评论(1

苍风燃霜 2024-09-08 21:53:18

状态转换有什么问题吗?您能提供完整的代码示例吗?

该代码段基本上按照我的预期工作:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

<s:transitions>
    <s:Transition id="t1" autoReverse="true">
        <s:CrossFade
            target="{this}" 
            duration="1500" />
    </s:Transition>
</s:transitions>
<s:states>
    <s:State name="State1" />
    <s:State name="studyState" />
</s:states>

<s:VGroup id="globalGroup" includeIn="State1" width="100%">
    <s:Button label="State1 to studyState" click="this.currentState = 'studyState'" />
</s:VGroup>
<s:VGroup id="studyGroup" includeIn="studyState" width="100%">
    <s:Button label="studyState to State1" click="this.currentState = 'State1'"  />
</s:VGroup>


</s:Application>

What is wrong about the state transition? Can you provide a full code sample?

This code segment, basically, works as I would have expected:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

<s:transitions>
    <s:Transition id="t1" autoReverse="true">
        <s:CrossFade
            target="{this}" 
            duration="1500" />
    </s:Transition>
</s:transitions>
<s:states>
    <s:State name="State1" />
    <s:State name="studyState" />
</s:states>

<s:VGroup id="globalGroup" includeIn="State1" width="100%">
    <s:Button label="State1 to studyState" click="this.currentState = 'studyState'" />
</s:VGroup>
<s:VGroup id="studyGroup" includeIn="studyState" width="100%">
    <s:Button label="studyState to State1" click="this.currentState = 'State1'"  />
</s:VGroup>


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