0

无论我做什么,我的转换都不会按预期工作。我将解释这些问题,然后将代码放在底部。

我的申请中有 4 个州。

goButton仅存在于"State1"和中"State2"

State1State2几乎相同,但每个的y属性goButton不同。所以我做了一点过渡,使按钮来回移动。目前很好。

但是,两者 "State1""State2"也可以转换为"State3"。但是没有goButtonin "State3",所以我使用了<s:Fade><s:RemoveAction>效果来摆脱它。

"State1"to过渡可以正常"State3"工作,但从to过渡不能"State2""State3"

当我尝试调用从"State2"到闪烁/闪烁"State3"的过渡goButton快速回到它所在的位置时"State1",只有过渡到"State3"实际发生。

这是我的goButton

<s:Button id="goButton" includeIn="State1,State2" x="319" y="212" width="33" height="33" click="goButton_clickHandler()" icon="@Embed('file:///C:/Users/Felipe/Downloads/1317358341_magnifier_medium.png')" toolTip="go" x.State2="319" y.State2="275"/>

这些是相关的转换:

<s:Transition fromState="State1" toState="State3" >
            <s:Sequence>
                <s:Fade duration="700" targets="{[searchLabel,searchTextInput,inLabel,inDropDownList,goButton,addNewLessonButton]}" />
                <s:RemoveAction targets="{[searchLabel,searchTextInput,inLabel,inDropDownList,goButton,addNewLessonButton]}" />
                <s:AddAction targets="{[lessonsDataGrid,backButton]}" />
                <s:Fade duration="700" targets="{[lessonsDataGrid,backButton]}" />
            </s:Sequence>
        </s:Transition>

        <s:Transition fromState="State2" toState="State3" >
            <s:Sequence>
                <s:Fade duration="700" targets="{[searchLabel,searchTextInput,inLabel,inDropDownList,tagsLabel,tagsTextInput,goButton,addNewLessonButton]}" />
                <s:RemoveAction targets="{[searchLabel,searchTextInput,inLabel,inDropDownList,tagsLabel,tagsTextInput,goButton,addNewLessonButton]}" />
                <s:AddAction targets="{[lessonsDataGrid,backButton]}" />
                <s:Fade duration="700" targets="{[lessonsDataGrid,backButton]}" />
            </s:Sequence>
        </s:Transition>

我的猜测是 Flex 总是(不要问我为什么)在执行转换之前将组件移回其原始位置。我尝试了这个应用程序的不同版本,在其中我将我的xy属性设置goButton为它们所在的位置"State2",然后设置x.State1 = something elsey.State1 = something else猜猜会发生什么?我得到了确切的反问题!从"State2"to转换"State3"是可以的,但是从"State1"to转换"State3"不起作用,因为goButton闪烁回到其原始位置(现在它是 中的位置"State2"),然后才会发生转换。

伙计,这让我发疯。 _ __ _ __ _ __ _ __ _ __ _ __ // _ __ _ __ _ __ _ __ _ __ _ _ _ __ _ __ _ __ _ __ __ _ __ _ __ _ __ _ __ _ __ _ // _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _

编辑

我添加了应用程序的链接 >>>> HERE <<<<<<您可以通过选择“选定标签”选项然后单击“goButton”来查看问题。你会看到我在说什么。查看源代码可用!!!

4

3 回答 3

2

看起来它正在为 State3 中的 goButton 寻找 x,y。如果您没有明确设置一个,它会回退到默认值。添加

x.State3="{this.x}" y.State3="{this.x}"

<s:Button id="goButton" ... />我修好它。

于 2011-10-28T03:51:31.573 回答
2

我觉得你把这弄得太复杂了。只需为按钮设置 includeIn="state1,state3" 。无需任何添加操作。然后创建一个将 goButton 设置为其目标的淡入淡出过渡。Spark fade 足够聪明,可以在没有您进一步帮助的情况下弄清楚如何处理这种情况。

查看http://polygeek.com/2304_flex_simple-flex-4-component-checkedunchecked了解更多详情。

于 2011-10-24T11:43:49.487 回答
0

>>>LL<<<<

好的,我想我已经挑出了这种行为,并且相信这是一个BUGGLITCH

我会看看是否有人要添加任何内容,如果没有人出现,我将提交错误报告。

重现步骤:

  • 创建一个在不同 x,y 坐标中以两种不同状态存在的按钮。例如,您的按钮将具有 x 和 y 的值,您必须将其位置设置为其他状态,例如x.State2 = somethingy.State2=something

  • 现在创建从 State2(如果 State1 是您的原始状态)到称为 State3 的第三个状态的转换。

  • 过渡应该有<s:Sequence>一系列步骤,最好涉及 RemoveActions 和 Fades,就像我上面使用的那样。
于 2011-10-24T22:55:38.437 回答