# Elastic mouse follow - X axis

**URL:** <https://forum.kirupa.com/t/elastic-mouse-follow-x-axis/289687>\
**Category:** flash\
**Created:** [June 3, 2009, 11:34am UTC](https://forum.kirupa.com/t/elastic-mouse-follow-x-axis/289687 "2009-06-03T11:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel1st](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@joel1st](https://forum.kirupa.com/u/joel1st)\
**Post date:** [June 3, 2009, 11:34am UTC](https://forum.kirupa.com/t/elastic-mouse-follow-x-axis/289687/1 "2009-06-03T11:34:50Z")

</div>

Hello.  
I’m currently creating a navigation bar for a project using flash cs4, action script 3.

As you can see in the picture there is a navigation bar, and inside this bar there is a small rectangle and two lines (located at the first located at x=25 and the second x=555).

![](http://forum.kirupa.com/uploads/kirupa/5436/c95af71e3859c1a7.png)

I want the rectangle to follow the mouse but be slightly delayed (elastic?)… Another requirement is that rectangle only moves on the x axis and therefore the y axis doesn’t change(it is y=68), but doesn’t move further than the two lines. The rectangle is a movie clip and its name is ‘rectangle’

I pretty much want it exactly the same as this [http://www.spoono.com/flash/tutorials/tutorial.php?id=24](http://www.spoono.com/flash/tutorials/tutorial.php?id=24)  
except the ball can only move on the x-axis and in between the two lines.

I really hope this makes sense…  
I would really appreciate any help I can get.

Thanks,  
Joel.
