# Using the tween class

**URL:** <https://forum.kirupa.com/t/using-the-tween-class/266566>\
**Category:** Uncategorized\
**Created:** [July 22, 2008, 5:57am UTC](https://forum.kirupa.com/t/using-the-tween-class/266566 "2008-07-22T05:57:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![armen\_shlang](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@armen\_shlang](https://forum.kirupa.com/u/armen_shlang)\
**Post date:** [July 22, 2008, 5:57am UTC](https://forum.kirupa.com/t/using-the-tween-class/266566/1 "2008-07-22T05:57:13Z")

</div>

I made a block that everytime the user rolls the mouse over, a shape will fade in and when the user rolls out, the shape fades out. It works fine, but it won’t if the user rolls out the mouse sooner than the end of the tweening.  
here is a link to that flash animation:  
[http://www.warplayart.com/page/navigation.html](http://www.warplayart.com/page/navigation.html)  
here is my code very simple.

```auto

import fl.transitions.Tween;
import fl.transitions.easing.*;

var inTween:Tween;
var outTween:Tween;
var currAlpha:Number;

import flash.events.MouseEvent;

alphaOver_mc.addEventListener(MouseEvent.MOUSE_OVER, fadeout);
alphaOver_mc.addEventListener(MouseEvent.MOUSE_OUT, fadein);

function fadein(event:MouseEvent):void
{
    inTween = new Tween(alphaOver_mc, "alpha",Regular.easeOut,0,1,1,true);
}
function fadeout(event:MouseEvent):void
{
   outTween = new Tween(alphaOver_mc, "alpha", Strong.easeOut,1,0,1,true);
}

```

The thing I’d like to do is record the value where the inTween has gone to and use that number as the starting number for the fadeout outTween.  
Why do i want to do that, because when you move out the mouse quickly, it messes up the animation.

- 

I do not know why the fade in and out get messed up when the mouse passes over the logo. The logo in inside the alphaOver\_mc movieClip.
