Apache flex Flex 4在状态之间转换的简单方法

Apache flex Flex 4在状态之间转换的简单方法,apache-flex,flex4,transitions,Apache Flex,Flex4,Transitions,是否有一种简单的方法,仅使用MXML,在添加和删除元素的状态之间进行转换 例如: <s:Group includeIn="state1"/> <s:Group includeIn="state2"/> 例如,MXML转换可以将状态1滑出,将状态2滑入吗 谢谢。除了上面的链接之外,还有一种方法可以将单个转换应用于多个目标: <?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:fx="http:/

是否有一种简单的方法,仅使用MXML,在添加和删除元素的状态之间进行转换

例如:

<s:Group includeIn="state1"/>
<s:Group includeIn="state2"/>

例如,MXML转换可以将状态1滑出,将状态2滑入吗


谢谢。

除了上面的链接之外,还有一种方法可以将单个转换应用于多个目标:

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:views="views.*"  >

    <s:states>
        <s:State name="home"/>
        <s:State name="help"/>
        <s:State name="instructions"/>
        <s:State name="settings"/>
        <s:State name="feedback"/>
    </s:states>

    <s:transitions>
        <s:Transition fromState="*" toState="*" >
            <s:Sequence >
                <s:Wipe direction="right" duration="350" target="{this}"/>
            </s:Sequence>
        </s:Transition>
    </s:transitions>

    <views:Home         id="home"       includeIn="home"            width="100%" height="100%" ownerComponent="{this}"/>
    <views:Help         id="help"       includeIn="help"            width="100%" height="100%" ownerComponent="{this}" />
    <views:Instructions id="instructions"   includeIn="instructions"    width="100%" height="100%" ownerComponent="{this}" />
    <views:Settings     id="settings"   includeIn="settings"        width="100%" height="100%" ownerComponent="{this}" />
    <views:Feedback     id="feedback"   includeIn="feedback"        width="100%" height="100%" ownerComponent="{this}" />

</s:Group>

上一个过渡将创建从一个方向到另一个方向的擦除

下一个过渡将从一个视图淡入另一个视图:

<s:transitions>
    <s:Transition fromState="*" toState="home" >
        <s:Sequence >
            <s:Fade target="{this}" alphaFrom="1" alphaTo="0"/>
            <s:RemoveAction targets="{[home,help,instructions,settings,feedback]}"/>
            <s:AddAction target="{home}"/>
            <s:Fade target="{this}" alphaFrom="0" alphaTo="1"/>
        </s:Sequence>
    </s:Transition>
</s:transitions>

下一个视图将滑入一个视图,而将其余视图滑出:

<s:transitions>
    <s:Transition fromState="*" toState="home" >
        <s:Sequence duration="1000" >
            <s:Parallel>
                <s:Move applyChangesPostLayout="true" targets="{notHomeTargets}" xFrom="0" xTo="{-width}"/>
                <s:AddAction target="{home}" />
                <s:Move applyChangesPostLayout="true" target="{home}" xFrom="{width}" xTo="0"/>
            </s:Parallel>
            <s:RemoveAction targets="{targets}" />
        </s:Sequence>
    </s:Transition>
</s:transitions>


您必须使用最后的示例为每个州创建一个

您是否阅读了有关使用状态转换的文档:?