# AS3 Motion Tween breaks

**URL:** <https://forum.kirupa.com/t/as3-motion-tween-breaks/265199>\
**Category:** Uncategorized\
**Created:** [July 5, 2008, 10:22pm UTC](https://forum.kirupa.com/t/as3-motion-tween-breaks/265199 "2008-07-05T22:22:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)\
**Post date:** [July 5, 2008, 10:22pm UTC](https://forum.kirupa.com/t/as3-motion-tween-breaks/265199/1 "2008-07-05T22:22:02Z")

</div>

When I am doing a motion tween the tween sometimes breaks. Sometimes it’s on mouse over; other times it seems to just be random.

It only tweens part of the way and the TweenEvent.MOTION\_FINISH never occurs.  
(Sometimes it works fine.)

To test it, visit [benbart.com/pcohen/](http://benbart.com/pcohen/) and click on Print-\>Consumer.

Here is the code:

function centerZoom(e:Event){

```
var currentX = this.x;
var currentY = this.y;
var newX = -e.target.x;
var newY = -e.target.y;

var currentScale = parent.scaleX;
var newScale = 1/e.target.scaleX;

var centerX:Tween = new Tween(this, "x", Regular.easeOut, currentX, newX, 1.2, true);
var centerY:Tween = new Tween(this, "y", Regular.easeOut, currentY, newY, 1.2, true);

var centerZoomX:Tween = new Tween(parent, "scaleX", Regular.easeOut, currentScale, newScale, 1.2, true);
var centerZoomY:Tween = new Tween(parent, "scaleY", Regular.easeOut, currentScale, newScale, 1.2, true);

centerX.addEventListener(TweenEvent.MOTION_FINISH, onMotionFinished);

stage.removeEventListener(MouseEvent.MOUSE_OVER, unblur);
stage.removeEventListener(MouseEvent.MOUSE_OUT, reblur);
stage.removeEventListener(MouseEvent.CLICK, centerZoom);
stage.addEventListener(MouseEvent.CLICK, zoomOut);

```

}

Thanks for any help. I’m an AS3 virgin.

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [July 5, 2008, 11:17pm UTC](https://forum.kirupa.com/t/as3-motion-tween-breaks/265199/2 "2008-07-05T23:17:49Z")

</div>

The default Adobe tween class is miserably bad. Use [TweenLite](http://www.tweenlite.com), you’ll love it. It’s a lot easier to use, performance is a ton better, etc. It’s become more or less the standard, the default classes just aren’t so good.

---

<div class="post-metadata">

**Author:** ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)\
**Post date:** [July 6, 2008, 1:36am UTC](https://forum.kirupa.com/t/as3-motion-tween-breaks/265199/3 "2008-07-06T01:36:53Z")

</div>

> [@Anogar;2354074](#):
>
> The default Adobe tween class is miserably bad. Use [TweenLite](http://www.tweenlite.com), you’ll love it. It’s a lot easier to use, performance is a ton better, etc. It’s become more or less the standard, the default classes just aren’t so good.

Thanks. That actually fixed everything. So I guess the error was with Adobe’s Tween class. I like that they made a TweenFilter as well. That will make my life easier.
