0

如何从 Tweenlite 中删除对象

        private var planeCards:Plane;
        protected function animate():void
        {

            for (var i:int = 0; i <planes.length; i++)
            {
                planeCards = planes[i];
                //Each if statement will adjust these numbers as needed
                var planeX:Number = 0;
                var planeZ:Number = -50;
                var planeRotationY:Number = 0
                if (i == currentItem)
                {
                    planeZ   = -300
                    TweenLite.to(planeCards, 1, { rotationY:planeRotationY,x:planeX,z:planeZ, ease:Quint.easeInOut } );
                }
                //Place & Animate Right Items
                if(i> currentItem)
                {
                    planeX   = (i - currentItem + 1) * 120;
                    planeRotationY   = angle + 10 * (i - currentItem);
                    TweenLite.to(planeCards, 1, { rotationY:planeRotationY,x:planeX,z:planeZ, ease:Quint.easeInOut } );
                }
                //Place & Animate Left Items
                if (i <currentItem)
                {
                    planeX   = (currentItem - i + 1) * -120;
                    planeRotationY   = -angle - 10 * (currentItem - i);
                    TweenLite.to(planeCards, 1, { rotationY:planeRotationY,x:planeX,z:planeZ, ease:Quint.easeInOut } );
                }
            }
        }

我想从 Tweenlite 中删除“planeCards”,因为如果我在运行时在“planes.length”中加载不同的图像意味着以前的图像不会隐藏。它显示在新图像后面,如何清除旧的“planeCards”我能做什么......请帮帮我

4

1 回答 1

2

1)您可以调用TweenLite.killTweensOf,这将停止指定目标的所有补间。

2)您可以使用不同的方法。如果您有几个补间并且需要一起管理它们,请考虑使用非静态方式。通过 new 创建补间,存储在某处,检索并在需要时停止:

var tween:TweenLite = new TweenLite(planeCards, 1,
    { rotationY:planeRotationY,x:planeX,z:planeZ, ease:Quint.easeInOut } );
tween.play();

// ...

tween.kill();
于 2011-09-13T06:38:20.890 回答