# Problem with tween re-writing y value

**URL:** <https://forum.kirupa.com/t/problem-with-tween-re-writing-y-value/305062>\
**Category:** flash\
**Created:** [February 18, 2010, 5:26pm UTC](https://forum.kirupa.com/t/problem-with-tween-re-writing-y-value/305062 "2010-02-18T17:26:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stereoscopic](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@stereoscopic](https://forum.kirupa.com/u/stereoscopic)\
**Post date:** [February 18, 2010, 5:26pm UTC](https://forum.kirupa.com/t/problem-with-tween-re-writing-y-value/305062/1 "2010-02-18T17:26:18Z")

</div>

Hi guys… I’m new to actionscript 3, and I was hoping someone might point me in the right direction. I’m trying to store the y position of an event.target on mouse roll over so that i can recall it after a tween has played to reset the target movie position back to original. At the moment, if I roll off and back on quickly (before the tween has finished playing) the y value is changed in the variable and so the target movie gets ‘pushed’ up the stage.  
I think there must be an easier way of doing this but I’ve been round the houses, and ended up with this- (the function that plays on roll over-)

```auto

function onOver(event:MouseEvent):void{
    var position:Point = new Point(event.target.x, event.target.y);
    var pos1:Number = (event.target.y);
    var pos2:Number = (event.target.y -= 3);
    inTween = new Tween(event.target,"y",Bounce.easeOut,pos1,pos2,1,true);
    outTween = new Tween(event.target,"y",Bounce.easeOut,pos2,pos1,1,true);
    outTween.addEventListener(TweenEvent.MOTION_FINISH,tweenfinished);
        function tweenfinished():void{
            event.target.x = position.x;
            event.target.y = position.y;
            outTween.removeEventListener(TweenEvent.MOTION_FINISH,tweenfinished);
        }
}

```
