开发者

how can i remove object from Tweenlite

how can i remove object from 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  开发者_Go百科 = -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 } );
                }
            }
        }

I want remove "planeCards" from Tweenlite because if i am loading different images in "planes.length" in run time means previous images will not hide. It display behind the new images, how can clear old "planeCards" want can i do.........pls help me


1) You can call TweenLite.killTweensOf, that will stop all the tweens for specified target.

2) You can use different approach. If you have a couple of tweens and need to manage them alltogether, consider using nonstatic way. Create tween via new, store somewhere, retrieve and stop if needed:

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

// ...

tween.kill();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜