# Animation with Tween class is duplicating movieclips?

**URL:** <https://forum.kirupa.com/t/animation-with-tween-class-is-duplicating-movieclips/174576>\
**Category:** flash\
**Created:** [January 6, 2006, 9:04pm UTC](https://forum.kirupa.com/t/animation-with-tween-class-is-duplicating-movieclips/174576 "2006-01-06T21:04:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slazareth](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@Slazareth](https://forum.kirupa.com/u/Slazareth)\
**Post date:** [January 6, 2006, 9:04pm UTC](https://forum.kirupa.com/t/animation-with-tween-class-is-duplicating-movieclips/174576/1 "2006-01-06T21:04:10Z")

</div>

Hey guys, if you’ll look at [http://extstudios.com/clients/klean/](http://extstudios.com/clients/klean/) let it load and then click on FASHION. All goes well. Then click on HOME. All goes well. Now click on FASHION again. after you’ve done each card once duplicate movie clips start popping up, but I’ve not called any such function. Here’s my code.

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;

    if (_root.nextCard == "Home") {
        
        var xScaleT:Tween = new Tween(cardHome, "_rotation", Regular.easeOut, 0, 30, 1, true);
        var xXPosT:Tween = new Tween(cardHome, "_x", Regular.easeOut, 11.9, 502.3, 1, true);
        var xYPosT:Tween = new Tween(cardHome, "_y", Regular.easeOut, 1.5, -648.5, 1, true);

        xYPosT.onMotionFinished = function() {
            cardHome.swapDepths(getNextHighestDepth());
            var xScaleT:Tween = new Tween(cardHome, "_rotation", Regular.easeIn, 30, 0, 0.85, true);
            var xXPosT:Tween = new Tween(cardHome, "_x", Regular.easeIn, 502.3, 11.9, 0.85, true);
            var xYPosT:Tween = new Tween(cardHome, "_y", Regular.easeIn, -648.5, 1.5, 0.85, true);
        };
    }
    if (_root.nextCard == "Fashion") {
        
        var xScaleT:Tween = new Tween(cardFashion, "_rotation", Regular.easeOut, 0, 30, 1, true);
        var xXPosT:Tween = new Tween(cardFashion, "_x", Regular.easeOut, 25.5, 502.3, 1, true);
        var xYPosT:Tween = new Tween(cardFashion, "_y", Regular.easeOut, 4.7, -648.5, 1, true);

        xYPosT.onMotionFinished = function() {
            cardFashion.swapDepths(getNextHighestDepth());
            var xScaleT:Tween = new Tween(cardFashion, "_rotation", Regular.easeIn, 30, 0, 0.85, true);
            var xXPosT:Tween = new Tween(cardFashion, "_x", Regular.easeIn, 502.3, 25.5, 0.85, true);
            var xYPosT:Tween = new Tween(cardFashion, "_y", Regular.easeIn, -648.5, 4.7, 0.85, true);
        };
    }

```

Anyone have an idea on how to fix this problem?
