# Need help with a Tween

**URL:** https://forum.kirupa.com/t/need-help-with-a-tween/321748
**Category:** Uncategorized
**Created:** [April 29, 2011, 2:39pm UTC](https://forum.kirupa.com/t/need-help-with-a-tween/321748 "2011-04-29T14:39:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![keitho30](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@keitho30](https://forum.kirupa.com/u/keitho30)
#### Post date: [April 29, 2011, 2:39pm UTC](https://forum.kirupa.com/t/need-help-with-a-tween/321748/1 "2011-04-29T14:39:40Z")

</div>

Hi guys, I have a slider animation that slides out on mouse over but I only want it to slide out when I have a drag and drop function working with it. So when I drag a particular MC onto the slider it moves out

Here is my code for the slide in animation:

> //SLIDER TWEEN  
> slider\_mc.addEventListener(MouseEvent.MOUSE\_OVER, slideIn);  
> slider\_mc.addEventListener(MouseEvent.MOUSE\_OUT, slideOut);

var slideMcIn = slider\_mc.x  
var slideMcOut = slider\_mc.x - 250;

function slideIn(e:MouseEvent){  
var myTween:Tween = new Tween(slider\_mc, “x”, Back.easeOut, slideMcIn, slideMcOut, 1, true);  
}

function slideOut(e:MouseEvent){  
var myTween:Tween = new Tween(slider\_mc, “x”, Back.easeOut, slideMcOut, slideMcIn, .6, true);  
}

//DRAG AND DROP FUNTION  
function ClickToDrag(event:MouseEvent):void  
{  
originalX = event.currentTarget.x;   
originalY = event.currentTarget.y;  
event.currentTarget.startDrag(false, boundArea);   
event.currentTarget.parent.addChild(event.currentTarget); /  
addEventListener(Event.ENTER\_FRAME, negativeHit);  
}  
function ReleaseToDrop(event:MouseEvent):void  
{  
var currentVid:Object = event.currentTarget;  
var currentX:Number = currentVid.x; //store for following ‘if’  
var currentY:Number = currentVid.y;  
event.currentTarget.stopDrag();

Any help would be appreciative. Thanks
