且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在数组中移动对象,从而在ActionScript中产生体育场波效果

更新时间:2023-10-26 20:57:16

您需要在moveDown函数中获取补间的对象并应用补间动画(增加y).

You need to grab the tweened object in moveDown function and apply motion tween (increase y).

function moveDown(e:TweenEvent):void {
  var sq:Sq = Sq(e.target.obj);
  var tweenDown:Tween = new Tween(sq,"y",None.easeOut, sq.y, sq.y + 50, 1, true);
  if (Sq(e.target.obj) === array[array.length - 1]) {
    trace("this is the last tween down");
    tweenDown.addEventListener(TweenEvent.MOTION_FINISH, lastTweenFinish);
  }
}
function lastTweenFinish(e:TweenEvent):void {
  trace("DONE");
}

还有另一件事,为什么要在moveUp功能中使用计时器t2.

One more thing why are you using Timer t2 in moveUp function.