# Calling a script on mouseover

**URL:** https://forum.kirupa.com/t/calling-a-script-on-mouseover/162011
**Category:** Uncategorized
**Created:** [September 8, 2005, 9:29pm UTC](https://forum.kirupa.com/t/calling-a-script-on-mouseover/162011 "2005-09-08T21:29:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![audiothc](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@audiothc](https://forum.kirupa.com/u/audiothc)
#### Post date: [September 8, 2005, 9:29pm UTC](https://forum.kirupa.com/t/calling-a-script-on-mouseover/162011/1 "2005-09-08T21:29:36Z")

</div>

Hello

I am making a swf where there is a long image that pans left to right depending on x mouse.  
At the moment the script works fine when attached to the clip itself.  
eg.  
[size=1]onClipEvent (enterFrame) {  
// pan movie clip where movie container size = 804  
cw = 804;  
// container size  
mx = \_xmouse;  
myx = \_x;  
mw = \_width;  
cf = (cw-mw)/mw;  
\_x = (mx\*(cf));  
if (myx\<-(mw-(mw/2))) {  
myx = 20;  
}  
}[/size]

I need this action to be called when i mouse over a button called ‘mc\_hit’  
The clip I want to pan is called ‘mc\_slide’.

Any assistance with this would be much appreciated  
Cheers

An example can be seen at [http://www.choruscollective.com/galleryfix/newgallery\_1.swf](http://www.choruscollective.com/galleryfix/newgallery_1.swf)  
[http://www.choruscollective.com/galleryfix/newgallery\_1.fla](http://www.choruscollective.com/galleryfix/newgallery_1.fla)
