如何从Tweenlite中删除对象

时间:2011-09-13 04:53:00

标签: flex actionscript-3 flex4 papervision3d tweenlite

如何从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” 我想做什么.....请帮助我

1 个答案:

答案 0 :(得分: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();
相关问题