Как я могу удалить объект из Tweenlite - PullRequest
0 голосов
/ 13 сентября 2011

как я могу удалить объект из 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 } );
                }
            }
        }

Я хочу удалить "planeCards" из Tweenlite, потому что, если я загружаю разные изображения в "planes.length" во время выполнения, значит, предыдущие изображения не будут скрыты.Он отображает за новыми изображениями, как можно очистить старые "карты", хочу ли я сделать ......... Пожалуйста, помогите мне

1 Ответ

2 голосов
/ 13 сентября 2011

1) Вы можете вызвать TweenLite.killTweensOf , который остановит все анимации для указанной цели.

2) Вы можете использовать другой подход.Если у вас есть пара подростков и вам нужно управлять ими в целом, рассмотрите возможность использования нестатического способа.Создайте анимацию с помощью нового, сохраните где-нибудь, восстановите и, если необходимо, остановите:

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

// ...

tween.kill();
...