无论我做什么,我的转换都不会按预期进行。我将解释这些问题,然后将代码放在底部。
我的申请中有 4 个州。
goButton
仅出现在 "State1"
和 "State2"
中。
State1
和 State2
几乎相同,但 goButton
的 y
属性各不相同。因此,我做了一个小小的转换,来回移动按钮。到目前为止还不错。
但是,“State1”
和 “State2”
也可以转换为 “State3”
。但是 "State3"
中没有 goButton
,所以我使用了
和
效果来摆脱它。
从 "State1"
到 "State3"
的转换工作ok,但从 "State2"
到 <代码>“State3” 没有。
当我尝试调用从 "State2"
到 "State3"
的转换时,goButton
快速闪烁回到原来的位置"State1"
并且仅实际发生到 "State3"
的转换。
这是我的 goButton
这些是相关的转换:
<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 总是(不要问我为什么)将组件移回其原始位置在执行转换之前。 我尝试了此应用的不同版本,其中我设置了 goButton
的 x
和 y
属性到它们在“State2”
中的位置,然后设置x.State1 = some else
和y.State1 = some else
,猜猜会发生什么?我得到了精确的逆问题!从 "State2"
到 "State3"
的转换是可以的,但是从 "State1"
到 "State3"
的转换是可以的不起作用,因为 goButton
闪烁回到其原始位置(现在是 "State2"
中的位置),然后才会发生转换。
伙计,这让我发疯。
__________________//____________________________ >___________
____________< /em>______ //_______________ _____________
<强>编辑
我添加了该应用程序的链接>>>>此处<<<<<<< 您可以通过选择“选定标签”选项然后单击“转到按钮”来查看问题。你就会明白我在说什么。查看源码可用!!!
No matter what I do, my transitions won't work as expected. I'll explain the issues and then place the code at the bottom.
There are 4 States in my application.
goButton
is present only in "State1"
and "State2"
.
State1
and State2
are nearly the same, but the y
property of the goButton
is diffrent in each. So I've made a little transition that moves the Button back and forth. Good so far.
However, both "State1"
and "State2"
can also be Transitioned to "State3"
. But there's no goButton
in "State3"
, so I've used the <s:Fade>
and the <s:RemoveAction>
effects to get rid of it.
The Transition from "State1"
to "State3"
works ok, but the Transition from "State2"
to "State3"
doesn't.
When I attempt to call the transition from "State2"
to "State3"
the goButton
flickers/flashes quickly back to the position where it was in "State1"
and only the the Transition to "State3"
actually takes place.
this is my 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"/>
and these are the relevant Transitions:
<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>
My guess is that Flex always (don't ask me why) moves the component back to its original position before performing a Transition. I've tried a different version of this app in which I set the x
and y
properties of my goButton
to what they are in "State2"
and then set x.State1 = something else
and y.State1 = something else
and guess what happens? I get the exact inverse problem! Transition from "State2"
to "State3"
is ok but the Transition from "State1"
to "State3"
doesn't work, as the goButton
flickers back to its original position (now it is the position in "State2"
) and only then does the Transition takes place.
Man this is driving me crazy.
__________________//______________________________
__________________ //____________________________
EDIT
I've added a link to the app >>>>HERE<<<<<< You can see the issue by selecting the option 'selected tags' and then clicking the 'goButton' . You'll see what I'm talking about. View source is available!!!
发布评论
评论(3)
看起来它正在为 State3 中的 goButton 寻找 x,y。如果您没有明确设置,它将回退到默认值。添加
到
为我修复了它。It looks like it's looking for an x,y for the goButton in State3. If you don't set one explicitly, it falls back to the default. Adding
to
<s:Button id="goButton" ... />
fixed it for me.我认为你把这件事搞得太复杂了。只需为按钮设置 includeIn="state1,state3" 即可。无需任何添加操作。然后创建一个淡入淡出过渡,将 goButton 设置为其目标。 Spark fade 足够聪明,可以在没有您进一步帮助的情况下找出如何处理这种情况。
查看http://polygeek.com/2304_flex_simple-flex-4-component-checkedunchecked 了解更多详情。
I think you're making this too complicated. Just set includeIn="state1,state3" for the button. No need for any add action. Then create one Fade transition that sets the goButton as its target. The Spark fade is smart enough to figure out how to handle that situation without further help from you.
Check out http://polygeek.com/2304_flex_simple-flex-4-component-checkedunchecked for more details.
>>>LL<<<<<
好吧,我想我已经挑出了这种行为,并且确实相信这是一个 BUG 或 GLITCH< /强>。
我会看看是否有人有任何要添加的内容,如果没有人出现,我将提交错误报告。
重现步骤:
创建一个在不同 x,y 坐标中呈现两种不同状态的按钮。例如,您的按钮将具有 x 和 y 值,并且您必须将其位置设置为其他状态,例如
x.State2 = some
和y.State2= some
现在创建从 State2(如果 State1 是您的原始状态)到名为 State3 的第三个状态的转换。
步骤序列,最好涉及 RemoveActions 和 Fades,就像我上面使用的那样。>>>LL<<<<
OK I think I've singled out this behaviour and do believe it's a BUG or GLITCH.
I'll see if anyone has anything to add and if nobody shows up I'll file a bug report.
Steps to reproduce:
create a button that's present in two different states, in different x,y coordinates. For example, your button will have a value for x and for y and you'll have to set its position in the other state, something like
x.State2 = something
andy.State2=something
now create a transition from State2 (if State1 is your original State) to a third State called State3.
<s:Sequence>
sequence of steps, preferably involving RemoveActions and Fades, like the ones I've used above.