# Menu animation - following mouse

**URL:** https://forum.kirupa.com/t/menu-animation-following-mouse/168157
**Category:** flash
**Created:** [November 4, 2005, 12:40pm UTC](https://forum.kirupa.com/t/menu-animation-following-mouse/168157 "2005-11-04T12:40:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![david\_brent](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@david\_brent](https://forum.kirupa.com/u/david_brent)
#### Post date: [November 4, 2005, 12:40pm UTC](https://forum.kirupa.com/t/menu-animation-following-mouse/168157/1 "2005-11-04T12:40:28Z")

</div>

I have a symbol that moves onto a button along the x axis when the mouse goes over the button.  
The buttons have the following code (or similair, depending on where it is on the stage) attatched:

on (rollOver) {  
yTargetMC = 358;  
}

(MC being the instance name of the symbol, and 358 being the center of that specific button)

The actions for the symbol reads as follows:

onClipEvent (enterFrame) {  
yMC = getProperty(\_root.MC, \_x);  
moveMC = \_root.yTargetMC - yMC;  
setProperty(\_root.MC, \_x, yMC + (moveMC/10));  
}

The symbol starts off the stage and zooms in when the mouse goes over a button. In the very first scene the symbol is told to go to one of the buttons as a starting point. Other scenes ommit this code in my hope that the symbol would just stay where it is scene after scene. It doesn’t.

After playing around with it I have had to keep the symbol starting off stage at the begining of every scene, otherwise it does nothing for that whole scene; it just stays put, even when the mouse goes over a button.

So currently everytime you click on a menu button, the symbol comes flying in from the side. I want it to stay where the user left it between scenes.

Cheers,  
Brent
