代码之家  ›  专栏  ›  技术社区  ›  FlyingCat

灵活动画问题

  •  0
  • FlyingCat  · 技术社区  · 14 年前

    我正在做一个简单的动画。我想淡入并调整CreationComplete内的列表的大小。我的问题是,在元素动画开始之前,我总能看到元素闪烁。另一个词是,用户将看到元素出现1秒->然后淡入并调整动画的大小。我希望这里的任何人都能帮助我。谢谢。。。

    我的代码。

    AS:

    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)"/>
    
    1 回复  |  直到 14 年前
        1
  •  1
  •   JeffryHouser    14 年前

    首先,我将把这些结合成一个单一的转换,可以是并行的,也可以是按您的喜好顺序的:

    <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}"`/>
    
    推荐文章