【问题标题】:Flex animation questionFlex动画问题
【发布时间】:2010-07-05 14:41:10
【问题描述】:

我正在尝试做一个简单的动画。我想在creationcomplete中淡入并调整列表的大小。我的问题是我总是可以在元素动画开始之前看到元素闪烁。换句话说,用户将看到元素出现 1 秒->然后淡入并调整动画大小。我希望这里的任何人都可以帮助我。谢谢...

我的代码。

作为:

protected function compList_creationCompleteHandler(event:FlexEvent):void
{

     compinfoResult.token = getCompList.compinfo();
     compinfoResult.addEventListener(ResultEvent.RESULT, completeLoading);

     function completeLoading(event:ResultEvent):void{

     fadeList.play();   //the animation will fire when the List get the result from the server...
     scaleList.play();

}
}

mxml


    <s:Scale id="scaleList" scaleXFrom="0" scaleXTo="1" scaleYFrom="0"
    scaleYTo="1" duration="500" target="{compList}" />
    <s:Fade id="fadeList" alphaFrom="0" alphaTo="1" target="{compList}" />


    <s:List id="compList"
    width="280"
    height="560"
    x="0"
    y="0"
    alpha="0"
    creationComplete="compList_creationCompleteHandler(event)"
    itemRenderer="itemRenderer.compListItemRenderer"
    change="compList_changeHandler(event)"/>

【问题讨论】:

    标签: apache-flex animation


    【解决方案1】:

    首先,我会将它们组合成一个单独的过渡,可以按照您的喜好并行或按顺序进行:

    <s:Sequence id="effectSequence">
      <s:Scale id="scaleList" scaleXFrom="0" scaleXTo="1" scaleYFrom="0"
    scaleYTo="1" duration="500" target="{compList}" />
      <s:Fade id="fadeList" alphaFrom="0" alphaTo="1" target="{compList}" />
    </s:Sequence>
    

    然后,我不会尝试通过事件手动触发它。改用效果,在这种情况下,我推荐creationCompleteEffect

     <s:List id="compList"
        width="280"
        height="560"
        x="0"
        y="0"
        alpha="0"
        creationComplete="compList_creationCompleteHandler(event)"
        itemRenderer="itemRenderer.compListItemRenderer"
        change="compList_changeHandler(event)"
        creationCompleteEffect="{effectSequence}"`/>
    

    【讨论】:

    • 很好......非常感谢。这就是我需要的......:D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-09
    相关资源
    最近更新 更多