0

我想在这样的 flex 移动应用程序中更改状态时添加转换:

<s:states>
    <s:State name="State1"/>

    <s:State name="resultsState"/>
</s:states>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:Transition fromState="''" toState="resultsState">
        <s:Sequence duration="2000">
            <s:Fade target="{myTitle}"/>
            <s:Move targets="{[cityNameInput,searchBtn]}"/>
            <s:AddAction target="{''}"/>
            />

        </s:Sequence>
    </s:Transition>
</fx:Declarations>
<s:Button id="about_state" includeIn="resultsState" label="About"
              click="result_state()" icon="@Embed('assets/About.png')"
              />

// 功能代码是:

private function result_state():void{
     currentState = 'resultsState';
}

请帮忙。

4

1 回答 1

2

您必须在组件的<s:transitions/>数组属性中声明您的转换,而不是在<fx:Declarations/>块中声明它:

<s:states>
    <s:State name="State1"/>
    <s:State name="resultsState"/>
</s:states>

<s:transitions>
    <s:Transition fromState="*" toState="resultsState">
        <s:Sequence duration="2000">
            <s:Fade target="{myTitle}"/>
            <s:Move targets="{[cityNameInput,searchBtn]}"/>
        </s:Sequence>
    </s:Transition>
</s:transitions>
<s:Button id="about_state" includeIn="resultsState" label="About"
              click="result_state()" icon="@Embed('assets/About.png')"/>

Adobe 文档站点上有大量示例。

于 2012-11-08T15:15:40.937 回答