查看动画结束时的过渡

时间:2011-10-23 03:30:27

标签: flex flex4

这是交易:

我的移动应用程序主页上有一个图像和一个按钮。

按按钮将动画应用于图像。这很好用。

问题:

我想添加一个视图转换,在动画完成后推送到下一个视图。

CODE:

AS

    protected function nextView()
    {
    navigator.pushView(View2);
    }

MXML:

    <s:Button id="Button" click="anim.play()"/> //anim.play() is in 
    //the declarations tag and is working as expected.

    <s:Image id="img" source="@Embed('assets/image.png')"/>

我试过了:

- 在动画调用

后将nextView()添加到click方法

- 在Button属性中使用effectEnd="nextView()"

感谢您提供的任何帮助和见解。

1 个答案:

答案 0 :(得分:0)

effectEnd似乎对我有用:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark"> 
    <fx:Declarations>
        <s:Move id="myEffect" xBy="100" target="{btn}" effectEnd="navigator.pushView(NextView)" />
    </fx:Declarations>

    <s:ViewNavigator id="navigator" width="100%" height="100%"/>

    <s:Button id="btn" label="play" click="myEffect.play()" />

</s:Application>