# Inertia rollover

**URL:** <https://forum.kirupa.com/t/inertia-rollover/24012>\
**Category:** Uncategorized\
**Created:** [June 25, 2003, 9:47am UTC](https://forum.kirupa.com/t/inertia-rollover/24012 "2003-06-25T09:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiband](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@aiband](https://forum.kirupa.com/u/aiband)\
**Post date:** [June 25, 2003, 9:47am UTC](https://forum.kirupa.com/t/inertia-rollover/24012/1 "2003-06-25T09:47:33Z")

</div>

Can someone help me out with this rollover.

My button rolls on to the stage with a superkool inertia effect. I would like to be able to rollover the button and have it move about 10 or 20 pixels to the right, with the same inertia effect. If you can help me out, the link to my fla is below.

thx!

[www.simmonsgsa.com/bridge/home\_test.fla](http://www.simmonsgsa.com/bridge/home_test.fla)

---

<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:** [June 25, 2003, 5:59pm UTC](https://forum.kirupa.com/t/inertia-rollover/24012/2 "2003-06-25T17:59:12Z")

</div>

does anyone get this?

---

<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:** [June 25, 2003, 6:26pm UTC](https://forum.kirupa.com/t/inertia-rollover/24012/3 "2003-06-25T18:26:17Z")

</div>

Remove the actions from your clip (all of them).

Add these actions to the frame where your stop() action is…

[AS]  
//function for elastic effect (written by Senocular)  
MovieClip.prototype.elasticMove = function(targt, accel, friction) {  
this.speed += (targt-this.\_x)\*accel;  
this.speed \*= friction;  
this.\_x += this.speed;  
};  
//first move it to original position  
buttonone.onEnterFrame = function() {  
this.elasticMove(10, .5, .7);  
};  
//onRollOver move it 20 px to the right (10+20 = 30)  
buttonone.onRollOver = function() {  
this.onEnterFrame = function() {  
this.elasticMove(30, .5, .7);  
};  
};  
//onRollOut move it back to the original position  
buttonone.onRollOut = function() {  
this.onEnterFrame = function() {  
this.elasticMove(10, .5, .7);  
};  
};[/AS]
