您可以使用Fade指定所有元素进行过渡,而不必单独列出吗?

问题描述

| 我已经有了一个air应用程序的开始,并且我正在尝试使用Fade(在理论上应该淡出然后进入下一个状态的顺序)在状态之间进行转换。将其定位为淡出所有元素,还是需要使用target = \“ ... \”并列出每个元素? 我尝试将所有元素嵌套在一个组中,但这似乎行不通。 我当前代码的简化版本:
<s:states>
    <s:State name=\"HomeScreen\"/>
    <s:State name=\"EnemyBuilder\"/>
    <s:State name=\"EncyclopediaBuilder\"/>
</s:states>
<fx:Declarations>
    <s:Transition toState=\"*\" fromState=\"*\" >
        <s:Sequence >
            <s:Fade alphaFrom=\"1\" alphaTo=\"0\" duration=\"250\" target=\"{wrapper}\" />
            <s:Fade alphaFrom=\"0\" alphaTo=\"1\" duration=\"250\" target=\"{wrapper}\" />
        </s:Sequence>
    </s:Transition> 
</fx:Declarations>

<s:Group id=\"wrapper\" includeIn=\"HomeScreen,EnemyBuilder,EncyclopediaBuilder\" >

<s:BorderContainer id=\"encounter\" includeIn=\"HomeScreen\" 
                   x=\"49\" y=\"99\" width=\"200\" height=\"44\" 
                   styleName=\"falseButton\"
                   rollOut=\"alphaOver(event)\" rollover=\"alphaOver(event)\" click=\"currentState=\'EncyclopediaBuilder\'\" >
    <s:Label x=\"48\" y=\"8\" color=\"#000000\" fontFamily=\"Arial\" text=\"Create a new encounter\" />
    <s:Label x=\"48\" y=\"24\" color=\"#000000\" fontStyle=\"italic\" text=\"Single encounter\" />
    <s:Image x=\"10\" y=\"10\" source=\"assets/001_01.png\" />
<s:BorderContainer id=\"back\" includeIn=\"EncyclopediaBuilder\" 
                   right=\"20\" bottom=\"20\" width=\"200\" height=\"44\"
                   styleName=\"falseButton\"
                   rollOut=\"alphaOver(event)\" rollover=\"alphaOver(event)\"
                   click=\"currentState=\'HomeScreen\'\" >
    <s:Label x=\"48\" y=\"16\" color=\"#000000\" fontFamily=\"Arial\" text=\"Save and Return\"/>
    <s:Image x=\"10\" y=\"10\" source=\"assets/001_01.png\"/>
</s:BorderContainer>        
</s:BorderContainer></s:Group>  
    

解决方法

        尝试使用类似以下的内容:
<s:states>
    <s:State name=\"HomeScreen\"/>
    <s:State name=\"EnemyBuilder\"/>
    <s:State name=\"EncyclopediaBuilder\"/>
</s:states>
<s:transitions>
    <s:Transition toState=\"*\" fromState=\"*\" >
        <s:Sequence target=\"{wrapper}\">
            <s:Fade alphaFrom=\"1\" alphaTo=\"0\" duration=\"250\" />
            <s:Fade alphaFrom=\"0\" alphaTo=\"1\" duration=\"250\" />
        </s:Sequence>
    </s:Transition> 
</s:transitions>

<s:Group id=\"wrapper\">

<s:BorderContainer id=\"encounter\" includeIn=\"HomeScreen\" 
                   x=\"49\" y=\"99\" width=\"200\" height=\"44\" 
                   styleName=\"falseButton\"
                   rollOut=\"alphaOver(event)\" rollOver=\"alphaOver(event)\" click=\"currentState=\'EncyclopediaBuilder\'\" >
    <s:Label x=\"48\" y=\"8\" color=\"#000000\" fontFamily=\"Arial\" text=\"Create a new encounter\" />
    <s:Label x=\"48\" y=\"24\" color=\"#000000\" fontStyle=\"italic\" text=\"Single encounter\" />
    <s:Image x=\"10\" y=\"10\" source=\"assets/001_01.png\" />
<s:BorderContainer id=\"back\" includeIn=\"EncyclopediaBuilder\" 
                   right=\"20\" bottom=\"20\" width=\"200\" height=\"44\"
                   styleName=\"falseButton\"
                   rollOut=\"alphaOver(event)\" rollOver=\"alphaOver(event)\"
                   click=\"currentState=\'HomeScreen\'\" >
    <s:Label x=\"48\" y=\"16\" color=\"#000000\" fontFamily=\"Arial\" text=\"Save and Return\"/>
    <s:Image x=\"10\" y=\"10\" source=\"assets/001_01.png\"/>
</s:BorderContainer>        
</s:BorderContainer></s:Group>