# Menu anim problem

**URL:** <https://forum.kirupa.com/t/menu-anim-problem/236219>\
**Category:** Uncategorized\
**Created:** [August 18, 2007, 3:11pm UTC](https://forum.kirupa.com/t/menu-anim-problem/236219 "2007-08-18T15:11:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandman01](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sandman01](https://forum.kirupa.com/u/sandman01)\
**Post date:** [August 18, 2007, 3:11pm UTC](https://forum.kirupa.com/t/menu-anim-problem/236219/1 "2007-08-18T15:11:26Z")

</div>

hi.  
I have a horizontal sliding menu with a bitmap mask added. I have made my menu from 2 identical pieces to create the illusion that it never ends.(i know it is not the best way but the one that first came into my head).  
then i slide the menu according to the mouse movement.  
Now my question is how can I make all the buttons inside the menu animate into the center of the Stage when I click any one of them?  
Btw here’s the as code, basic stuff nothing to fancy :

[COLOR=royalblue]menu.setMask(masker);  
var home:MovieClip = this;[/COLOR]  
[COLOR=royalblue]var listener:Object = new Object();[/COLOR]  
[COLOR=royalblue]listener.onMouseMove = function()  
{  
if (panel.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)){  
panel.onEnterFrame = scrollPanel;  
}  
if (!panel.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)){  
delete panel.onEnterFrame;  
}  
}[/COLOR]  
[COLOR=royalblue]var w:Number = 800;[/COLOR]  
[COLOR=royalblue]function scrollPanel():Void{

var xdist = \_xmouse - Stage.width/2;[/COLOR]  
[COLOR=royalblue] menu.\_x += -xdist/10;

if (menu.\_x \> 0) {  
menu.\_x= -w;  
}  
if (menu.\_x \< -w) {  
menu.\_x=0;  
}

}[/COLOR]  
[COLOR=royalblue]Mouse.addListener(listener);[/COLOR]
