# Moving image when button released

**URL:** <https://forum.kirupa.com/t/moving-image-when-button-released/57925>\
**Category:** flash\
**Created:** [July 17, 2004, 9:49pm UTC](https://forum.kirupa.com/t/moving-image-when-button-released/57925 "2004-07-17T21:49:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byron\_2](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@byron\_2](https://forum.kirupa.com/u/byron_2)\
**Post date:** [July 17, 2004, 9:49pm UTC](https://forum.kirupa.com/t/moving-image-when-button-released/57925/1 "2004-07-17T21:49:06Z")

</div>

this is old and I used to know but forgotten over time. How do you scroll an image across to a certain point when a button is released?

Preferably with easing.

Cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 2:24am UTC](https://forum.kirupa.com/t/moving-image-when-button-released/57925/2 "2004-07-18T02:24:17Z")

</div>

on(load){  
function imageMover(finalX,finalY){  
pathToImage.\_x += (pathToImage.\_x - finalX)/2;//change the 2 to a bigger number for smoother easing  
pathToImage.\_y += (pathToImage.\_y - finalY)/2;  
if(Math.floor(pathToImage.\_x)==finalX && Math.floor(pathToImage.\_y)==finalY){  
pathToImage.\_x=finalX;  
pathToImage.\_y=finalY;  
clearInterval(moveImage);  
}  
}  
}  
on(release){  
moveImage = setInterval(this.imageMover, 50, 234, 432);//234, 432 are the final x y coordinates  
}

This was written on the fly but it should work, just put it on the button, and modify the path to the image you want to move…and if it doesn’t work this topic gets covered every other day or so, so you might consider a search for more info than I can provide.
