# Stopping movement in actionscript

**URL:** <https://forum.kirupa.com/t/stopping-movement-in-actionscript/226426>\
**Category:** Uncategorized\
**Created:** [May 21, 2007, 1:33pm UTC](https://forum.kirupa.com/t/stopping-movement-in-actionscript/226426 "2007-05-21T13:33:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![becdizzle](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@becdizzle](https://forum.kirupa.com/u/becdizzle)\
**Post date:** [May 21, 2007, 1:33pm UTC](https://forum.kirupa.com/t/stopping-movement-in-actionscript/226426/1 "2007-05-21T13:33:49Z")

</div>

[FONT=Arial]Hi,

I’m having trouble making a scrolling “portfolio” for a website.

Basically, when the mouse is over the left arrow, it moves right & visa versa. The problem i’m having is that I can’t stop it when the mouse leaves the arrow.

It’s a graphic thats moving left & right with a mask over the top.

Hopefully that made sense - my code is below.

## Thanks!

function left(){  
movement=10;  
position = 10+movement;  
identity.\_x = identity.\_x + movement;  
}  
function right(){  
movement=10;  
position = 10+movement;  
identity.\_x = identity.\_x-movement;  
}

function goleft(){  
identity.onEnterFrame = left;

}  
function goright(){  
identity.onEnterFrame= right;  
}  
//this is where i’d put the method for it to stop moving…  
function s(){  
identity.stop();  
}  
movement\_mc.onRollOver= s;  
left\_mc.onRollOver = goleft;  
left\_mc.onRollOut = s;  
right\_mc.onRollOut = s;  
right\_mc.onRollOver = goright;  
[/FONT]
